Hi devs,
As you may know, we are currently using a pretty old version of
Hibernate in XWiki and we could benefit from its upgrade. The new
version should bring many bug and security fixes (even though they
don't all apply to our current version) along with better APIs and the
possibility to integrate other tools (such as other / newer libraries
or a better connection pool such as the one mentioned in [1])
Currently, I've been trying to make the following upgrades:
* 3.6.9 to 4.0.1
* 4.0.1 to 4.3.11
* 4.3.11 to 5.0.12
The goal is to arrive at version 5.4.0, which is at this date the
latest stable version.
I chose to make the upgrade step by step to avoid having to much
issues to solve at once.
So far, I've made a pull request ([2]) that you can check for the 4.0.1 upgrade.
Here are some of the issues that I've encounter during the upgrades:
3.6.9 to 4.0.1:
* Conflicting dependencies: I had to exclude some dependencies in the pom file.
* The org.hibernate.Session#connection method removal [3]: I'm either
using the Session#doWork method or the Session#createSQLQuery one.
* The org.hibernate.connection.ConnectionProvider interface has
changed: I had to adapt the DBCPConnectionProvider class that we have,
mostly to keep backward compatibility, using C3P0ConnectionProvider as
a model.
* The Session#getSession(EntityMode) method has been removed [4]: I
have no idea how to replace that so we need to test it properly.
* Some attributes in org.hibernate.cfg.Configuration have been
removed: This has mostly an impact on the custom mapping injection
which we need to check.
4.0.1 to 4.3.11:
* A change in the hibernate schema update generation makes the update
fail [5]: I had to add a property in the hibernate file but I don't
think this is the best solution.
4.3.11 to 5.0.12:
* The org.hibernate.cfg.Configuration has changed again removing many
methods that we were using
There are some other issues that I've not mentioned or discovered yet.
So for me the biggest issues are:
* The schema update: I think we should start using the hibernate one
instead of our own (except for migration made with liquibase).
* The custom mapping injection: We will need to rewrite it a bit if we
want to upgrade to 5.x.
The goal for now is to make the 4.0.1 upgrade work.
Please let me know what you think or if you have any questions.
Thanks,
Adel
[1]
https://jira.xwiki.org/browse/XWIKI-8286?focusedCommentId=96486l#comment-96…
[2]
https://github.com/xwiki/xwiki-platform/pull/1012
[3]
https://hibernate.atlassian.net/browse/HHH-2603
[4]
https://hibernate.atlassian.net/browse/HHH-6330
[5]
https://hibernate.atlassian.net/browse/HHH-8162