Quite a few folks have asked about the new Hibernate Core modules introduced with the 3.3 release: what each is for, when to use which, etc. I wanted to take a bit to describe what each of the main modules is for and when/how you would use certain combinations. (These modules also define maven artifacts; all Hibernate Core artifacts use org.hibernate groupId).
Hibernate Core 3.3.1 has just been released with its artifacts published to the JBoss Maven Repository. This release fixed a serious issue with CurrentSessionContext (SessionFactory.getCurrentSession()) when running on IBM WebSphere. It also includes quite a few improvements to the enhanced id generators. For details about all the changes in this release, check out it's changelog
3.3.0.GA got released the other day with an uncaught problem. A public method got removed from some of the events (specifically PreInsertEvent and PreUpdateEvent) which is causing problems with Hibernate Validator and which will probably cause problems for any applications utilizing custom listeners for those events.
Moving Hibernate source code to our new Subversion home is done. Both developer
and annonymous access have been set up. Currently, web access is only available
via the Apache module which is less than ideal. We have been told that either Fisheye
or ViewCVS access over the Subversion repsoitory will be setup soon.
A bug report was recently
opened in Hibernate's JIRA stating that Hibernate incorrectly handles deadlock scenarios.
The basis for the report was an example in the /Pro Hibernate 3/ book (Chapter 9). For
those perhaps not familiar with the term deadlock, the basic gist is that two processes
each hold resource locks that the other needs to complete processing. While this phenomena
is not restricted to databases, in database terms the idea is that the first process (P1)
holds a write lock on a given row (R1) while the second process (P2) holds a write lock on
another row (R2). Now, to complete its processing P1 needs to
acquire a write lock on R2, but cannot do so because P2 already holds its write lock.
Conversely, P2 needs to acquire a write lock on R1 in order to complete its processing,
but cannot because P1 already holds its write lock. So neither P1 nor P2 can complete
its processing because each is indefinitely waiting on the other to release the needed
lock, which neither can do until its processing is complete. The two processes are said
to be deadlocked in this situation.
As I mentioned in my previous blog about
Bulk Operations ,
both UPDATE and DELETE statements are challenging to handle against single
entities contained across multiple tables (not counting associations), which
might be the case with:
The EJB3 persistence specification calls for implementors to
support Bulk Operations in EJB-QL (the EJB Query Language). As part of Hibernate's implementation of
EJB3 persistence, HQL (the Hibernate Query Language : which is a superset of EJB-QL) needed to support
these Bulk Operations. This support is now code complete, even going beyond what is offered in the EJB3
persistence specification. There is one task outstanding against this bulk operation support in HQL, but
this is completely beyond the scope of the support called for in the EJB3 persistence specification.
I'll blog about this one later as it simply rocks ;)
New to Hibernate 3.0.1 is the SessionFactory.getCurrentSession() method.
It allows application developers to delegate tracking of current sessions to Hibernate itself.
This is fairly trivial functionality, but stuff just about any user of Hibernate had to implement themselves,
or rely on third party stuff to do for them. Let's take a look at how this is implemented in Hibernate and
how it might be useful.