Hibernate ORM 4.1.1 has just been released. This release contains a slew of improvements and bug fixes. Some specific changes of interest include:
- Big performance increase in the internal QueryPlanCache class which caused caching of HQL, JPQL and native-SQL
compilation
to be a bottleneck in concurrency (HHH-5927) - bunch of improvements to the new 4.1 natural id loading feature, such as the ability to load load by natural ids using persistent inheritance (HHH-7046) and
- Speaking of natural id loading improvements, HHH-7129 specifically may cause issues with applications already using @NaturalId in an unintended. Previously Hibernate had let you define annotations anywhere within an a persistent hierarchy (even spread across the hierarchy). That was never an intended usage of @NaturalId and attempting to do so now throws an exception.
- Allowing JPA static metamodel population to still happen even if model uses non-JPA features such as @Any mappings (HHH-6589)
- Support for custom collection types using annotations via new @CollectionType annotation (HHH-4417)
- On the documentation side, the documentation has all been migrated to DocBook v5 now which is great. A lot of the devguide has been finished out. I am still making the older manual available under 4.1 as well until all pertinent content has been migrated. That work required a lot of coordination between a group of a few of us at Red Hat that work on the DocBook and styling side of things. We work under the group name PressGang, and we could desperately use help. None of us are really design nor DocBook people so-to-say. If anyone is knowledgeable in that area and willing to help out, contact us via our PressGang Google+ group End of shameless plug :)
Speaking of Google+, I just created our Hibernate.org Google+ account too!
See the chagelog for more detailed breakdown of all the changes.
Created: 08. Mar 2012, 20:46 CET (Steve Ebersole)
Last Modified: 08. Mar 2012, 20:46 CET (Steve Ebersole)
testing Hibernate ORM 4.1.1 we discovered a behavior change regarding Optimistic Lock Versioning in detail on bidirectional OneToMany relation updated with inverse-owner (mappedBy attribute specified):
- until Hiberante version 4.1.0 by default both involved sides got a version increment - now with Hiberante4.1.1 only the owner-side (the Many-side) gets a version increment.
To make the thing working as before, now on such relations we must define explicitly OptimisticLock.excluded to false
Was such behavior change intended? I looked at the 28 issues which had been fixed with Hiberante4.1.1 but found nothing in regard, maybe I overlooked something ?
Steve wrote:
Thank you Steve,
anyway in this context there's to say that it is recommend strongly to force version increment on OneToMany relations when the collection is a map.
This because otherwise 2 concurrent transactions will be able to insert objects in the map using the same key value, without getting any exception at flush or commit. This leads finally in having 2 records on database whilst in hibernate (due the constraints of a map) you always will see just one. This is quite dangereous.
And as I also responded
Thanks for @CollectionType annotation!
Is there a way to configure Hibernate EntityManagerFactory programmatically for EJB container? The EJBConfiguration seems to be useless in EJB container.
So where the *** is it. I can't find any 4 dot anything in the jboss repository. 3.6 is the latest.
UserType nullSafeGet { DelegatingResultSet drs=(DelegatingResultSet) rs; ors=(OracleResultSet) drs.getDelegate(); } hibernate3 can work,hibernate4 can't work,exception: java.lang.ClassCastException: $Proxy7 cannot be cast to oracle.jdbc.OracleResultSet at com.quicksoft.commons.hibernate.UserXmlTypeHibernate.nullSafeGet(UserXmlTypeHibernate.java:92) at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:124) at org.hibernate.type.AbstractType.hydrate(AbstractType.java:106) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2702) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1541) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1473) at org.hibernate.loader.Loader.getRow(Loader.java:1373) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:640) at org.hibernate.loader.Loader.doQuery(Loader.java:850) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:289) at org.hibernate.loader.Loader.doList(Loader.java:2447) at org.hibernate.loader.Loader.doList(Loader.java:2433) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2263) at org.hibernate.loader.Loader.list(Loader.java:2258) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:470) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:355) at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:196) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1161) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101)