I use 4.3.11 in my Liberty projects but there is a bug with Hibernate solved in version 5. I have tried upgrading but I get different exceptions.
Anybody is using Hibernate 5.x.x with Liberty Profile? What jars are you including in the dataSource library in server.xml?
thanks
As of Hibernate 5.2.13, a proper transaction integration has been delivered for Liberty. If you are able to upgrade to this version of Hibernate, then it will be detected and applied automatically, and not necessary to specify
hibernate.transaction.jta.platform
anymore.See this Hibernate issue for more details: https://hibernate.atlassian.net/browse/HHH-11571
Even i ended up with similar situation. The exception message was: com.ibm.ws.container.service.state.StateChangeException: javax.xml.stream.FactoryConfigurationError: Provider javax.xml.stream.XMLEventFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.stream.XMLEventFactory: Provider com.ibm.xml.xlxp2.api.stax.XMLEventFactoryImpl not found
do you see any break through?
I've been able to get Hibernate 5.x at least partially working in Liberty if I include these JARs:
The reason I say partially working is that it works great if using non-jta-data-source, but when trying to use jta-data-source, Hibernate can fail trying to locate vendor-specific API to suspend the current transaction. Hibernate does have some properties that you can set to tell it that it's being used by WebSphere servers, and I've explored various combinations of those without a successful outcome for jta-data-source. I think the Hibernate implementation is lacking in its awareness of Liberty, which is something that really ought to be added, (see HHH-10388 and vote for it if you would find it valuable) although in its absence you can get it working by writing your own implementation of Hibernate JtaPlatform that delegates to com.ibm.tx.jta.TransactionManagerFactory and specifying it as a persistence property.
For example in persistence.xml,
Example implementation,
I know the thread is a bit old, but comparing Liberty Profile 17.0.0.2 and 17.0.0.3 I have noticed they have introduced this class
and now when I start the app server, the container passes some properties when calls
to initialize hibernate for a data-source and in the properties you have the instance of that class:
Hope it helps.