Opened 29 hours ago

Last modified 9 minutes ago

#2345 new task

Update to Hibernate 6

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE Future Release
Component: core Version:
Keywords: Cc:

Description

I think we need to do this sooner or later. We are currently using Hibernate 5.6 which is old and only has limited support. It supports up to Java 18 (but I have been running on Java 20 without problem).

In the future we may end up in a situation where a new OS only works with a Java version where Hibernate 5.6 doesn't work.

I have made some initial tests and there are a lot of breaking changes in Hibernate between 5.6 and 6.6 (the current version). It is very unlikely that we can switch without breaking some of our own API and without introducing some incompatible changes. For example:

  • XML-based mapping is no longer in the documentation. It is still supported but it would be nice to move over to annotation-based mapping. This will affect our solution with "extended properties" which generates XML mappings on the fly.
  • The type-system in Hibernate is in a constant re-factoring state. There seems to be a lot of changes and they are always a bit hard to find replacements.
  • Accessing metadata for generic functionality. We are using this in some places (for example for exporting). The API for accessing metadata is also in constant re-factoring state.
  • By-passing Hibernate and interacting directly with JDBC. Hibernate is always making it harder to obtain and use the underlying JDBC connection. This may affect some of our batch API:s.

Maybe this is also a good time to start removing some things in BASE that we are no longer using. For example:

  • Array LIMS (with some exceptions like Plate geometry)
  • Experiments
  • Reporters
  • Raw bioassays

Change History (5)

comment:1 by Nicklas Nordborg, 5 hours ago

In 8345:

References #2345: Update to Hibernate 6

Decided to first go to Hibernate 6.0.2 before trying a more recent version. Removed JAR files related to the Hibernate 5.6.15 and added new JAR files.

Eclipse reports 1043 compilation errors and 91 warnings. Most errors seems related to org.hibernate.type.* classes that are missing and new methods in some interfaces that we are wrapping (eg. Session, Query).

comment:2 by Nicklas Nordborg, 5 hours ago

In 8346:

References #2345: Update to Hibernate 6

Modified TypeWrapper to use org.hibernate.type.StandardBasicTypes instead. Compilation errors are down to 446.

comment:3 by Nicklas Nordborg, 3 hours ago

In 8347:

References #2345: Update to Hibernate 6

Changed javax.persistence... to jakarata.persistence....

Removed and modified lots of methods in the wrapper classes so that they match the current API. They are still missing a lot of new methods.

Compilation errors are down to 163 and warnings 79.

comment:4 by Nicklas Nordborg, 15 minutes ago

In 8348:

References #2345: Update to Hibernate 6

Added missing methods to wrapper classes.
72 compilation errors and 75 warnings.

comment:5 by Nicklas Nordborg, 9 minutes ago

In 8349:

References #2345: Update to Hibernate 6

org.hibernate.engine.spi.RowSelection has been replaced with org.hibernate.query.spi.Limit. 66 errors, 75 warnings.

Note: See TracTickets for help on using tickets.