Help

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.

8 comments:
 
09. Mar 2012, 12:21 CET | Link
Guenther Demetz

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

@javax.persistence.OneToMany(mappedBy = "parent")
@org.hibernate.annotations.OptimisticLock(excluded=false)
@javax.persistence.MapKey(name="field1")
private Map<String,Child> aggChild = new java.util.HashMap();

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 ?

 
09. Mar 2012, 14:20 CET | Link
Guenther Demetz

Steve wrote: The old behavior violated JPA spec. The issue is HHH-7138

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.

 
09. Mar 2012, 15:52 CET | Link

And as I also responded

Indexed collections (maps and lists) should always be the owning side of bi-directional associations for the exact reason you mention. Not sure if annotations actually enforces that or whether JPA even allows us to enforce that.
 
18. Mar 2012, 06:22 CET | Link
Anton

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.

 
27. Mar 2012, 04:53 CET | Link
John

So where the *** is it. I can't find any 4 dot anything in the jboss repository. 3.6 is the latest.

20. Apr 2012, 14:27 CET | Link
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)

 
02. Sep 2014, 08:48 CET | Link
jack

The most critical part of making great turns oral surgery boynton beach is consistent ankle flexion throughout the turn.

 
21. Nov 2014, 03:01 CET | Link
discount