[jboss-user] [EJB 3.0] - Hibernate case sensitivity problem

Paul Dunster do-not-reply at jboss.com
Fri May 7 11:21:26 EDT 2010


Paul Dunster [http://community.jboss.org/people/Paul_Dunster] created the discussion

"Hibernate case sensitivity problem"

To view the discussion, visit: http://community.jboss.org/message/541824#541824

--------------------------------------------------------------
Hi everyone, I'm after some help please.

I have a case-sensitivity problem with Hibernate.  Essentially I have no option but to support a customer that requires a case INSENSITIVE SQL DB.  At the time we agreed to do this, the software ran using JBOSS 4.0.5. For many reasons we settled for a major hack to get hibernate working in an acceptable manor so that the following is permissible :-

In business logic on a stateless session bean, we may need to load (using an EntityManager) a salesorderitem entity.  
The salesorderitem entity has a ManyToOne join to the ProductEntity.  For this specific salesorderitem record, the productId may 
be in lowercase, but on the Product record, the productId may be upper case. We may then need to get one of the properties from 
the ProductEntity using the aforementioned join.  In other words, case INSENSITIVE joins.

The hack was to use an AOP approach to replace the hibernate code that prevents the above scenario.  I'm told that the following 
classes and methods were identified as the reason we had to do this :-

org.hibernate.loader.Loader#getKeyFromResultSet - changed so that the EntityKey returned has the persisted pk Id, not the one used to load the record.

org.hibernate.util.EqualsHelper#equals - change to use equalsIgnoreCase if the two objects being compared were Strings.

Due to time constraints, commercial pressures blar blar blar, we went with this, as it worked.

Now the problem, since we went to JBOSS 4.2.3, with a newer version of the hibernate3 jar, this 'solution' 
has stopped working.

Does anyone know of a better approach to solving our problem?  If not, does anyone know what was changed in hibernate
that would inforce case SENSITIVE joins?

Thanks in advance, Paul.

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/541824#541824]

Start a new discussion in EJB 3.0 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2029]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100507/931b3843/attachment-0001.html 


More information about the jboss-user mailing list