Skip to content

Fix missing HibernateAccounting class#3949

Merged
sebr72 merged 4 commits intomasterfrom
clustering-spring7-fix
Feb 10, 2026
Merged

Fix missing HibernateAccounting class#3949
sebr72 merged 4 commits intomasterfrom
clustering-spring7-fix

Conversation

@lanseg
Copy link
Copy Markdown
Contributor

@lanseg lanseg commented Jan 29, 2026

No description provided.

@lanseg lanseg force-pushed the clustering-spring7-fix branch from 04076fd to a1cc61f Compare January 29, 2026 10:24
@lanseg lanseg requested review from sbrunner and sebr72 February 2, 2026 14:01
@lanseg lanseg marked this pull request as ready for review February 2, 2026 14:01
@lanseg
Copy link
Copy Markdown
Contributor Author

lanseg commented Feb 2, 2026

That pull request only addresses the db connection and querying issues. It's a bit similar to @sbrunner's #3943, but doesn't touch the CI/CD test running workflows

Copy link
Copy Markdown
Contributor

@sebr72 sebr72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes. Could you please add a test, justifying why these changes were required ?

@lanseg
Copy link
Copy Markdown
Contributor Author

lanseg commented Feb 3, 2026

Thanks for the fixes. Could you please add a test, justifying why these changes were required ?

The failure happens because of the difference in the mapfish_spring_hibernate.xml files:

  • test/.../mapfish_spring_hibernate.xml had the line "org.mapfish.print.servlet.job"
  • src/.../mapfish_spring_hibernate.xml didn't have this line

So the tests were not validating the behavior at runtime.

@lanseg lanseg requested a review from sebr72 February 3, 2026 11:00
@lanseg lanseg marked this pull request as draft February 4, 2026 16:52
@lanseg
Copy link
Copy Markdown
Contributor Author

lanseg commented Feb 6, 2026

The last commit (ef04b27) is needed to reduce amount of the database structure changes, e.g.:

Old Spring / Hibernate New Spring / Hibernate New with explicit types
layout TEXT NOT NULL layout character varying (255) layout TEXT NOT NULL

The full DB structure comparison was done using the following steps:

  1. Start DB and the print server based on the "old" spring.
  2. Do 100 print requests, then dump the database contents (spring5_dump.sql.zip)
  3. Stop the spring5 print server, start the spring 7 print serve, dump the database contents (spring7_dump.sql.zip)
  4. Do 100 print requests, then dump the database contents (spring7_updated_dump.sql.zip)

The results were in line with expectations:

  • spring5_dump.sql and spring7_dump.sql have exactly the same CREATE and COPY statements, which means the migration will not destroy an existing data.
  • spring5_dump.sql and spring7_dump_updated.sql have exactly the same CREATE statements, the COPY statement has 200 lines (100 from step 2, 100 more from step 4).

@lanseg
Copy link
Copy Markdown
Contributor Author

lanseg commented Feb 10, 2026

Current status: one failing test, "PrintApiTest > testSecuredTemplate_CreateMap()"

Test fails when running acceptance tests in clustering mode. Not a regression, because it failed with the same error before spring7 migration and after the migration.

@lanseg lanseg marked this pull request as ready for review February 10, 2026 11:42
Copy link
Copy Markdown
Member

@sbrunner sbrunner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, that looks good. What do you think @sebr72?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Hibernate/Spring configuration and entity mappings so Hibernate can discover the accounting entity and better handle longer string/JSON fields in the PostgreSQL-backed job/accounting tables.

Changes:

  • Add org.mapfish.print.servlet.job to Hibernate packagesToScan so HibernateAccountingEntry is discovered as an entity.
  • Adjust job-related entity columns to use PostgreSQL TEXT for potentially long string fields/identifiers.
  • Update polling lock behavior to use UPGRADE_SKIPLOCKED and remove the previous pessimistic-lock exception fallback.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
core/src/main/resources/mapfish-spring-hibernate.xml Ensures Hibernate scans the package containing HibernateAccountingEntry.
core/src/main/java/org/mapfish/print/servlet/job/impl/hibernate/PrintJobDao.java Changes polling lock mode to skip locked rows and simplifies result handling.
core/src/main/java/org/mapfish/print/servlet/job/impl/PrintJobStatusImpl.java Switches key/error columns to PostgreSQL TEXT.
core/src/main/java/org/mapfish/print/servlet/job/impl/PrintJobResultImpl.java Switches URI/metadata/reference columns to PostgreSQL TEXT.
core/src/main/java/org/mapfish/print/servlet/job/PrintJobEntry.java Switches embedded reference/request columns to PostgreSQL TEXT.
core/src/main/java/org/mapfish/print/servlet/job/HibernateAccountingEntry.java Uses PostgreSQL TEXT for string columns and adds Hibernate JSON type mapping for jsonb stats.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sbrunner
Copy link
Copy Markdown
Member

Current status: one failing test, "PrintApiTest > testSecuredTemplate_CreateMap()"

Test fails when running acceptance tests in clustering mode. Not a regression, because it failed with the same error before spring7 migration and after the migration.

=> 6c82a26

Copy link
Copy Markdown
Contributor

@sebr72 sebr72 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Thanks.
Quick note: We will add the tests for this PR using a different PR.

…e/PrintJobDao.java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sebr72 sebr72 merged commit 46fdcf5 into master Feb 10, 2026
15 checks passed
@sebr72 sebr72 deleted the clustering-spring7-fix branch February 10, 2026 13:49
@geo-ghci-int geo-ghci-int bot added this to the 4.0.0 milestone Feb 13, 2026
@sbrunner sbrunner added the chore Build, CI, Code style, Types, Test, ... label Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Build, CI, Code style, Types, Test, ...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants