-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate case sensitivity problem
PostPosted: Mon May 10, 2010 4:39 am 
Newbie

Joined: Mon May 10, 2010 3:38 am
Posts: 1
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 Session.get()) 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 :-

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

2. 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.


Top
 Profile  
 
 Post subject: Re: Hibernate case sensitivity problem
PostPosted: Wed Apr 20, 2011 4:47 pm 
Newbie

Joined: Wed Apr 20, 2011 4:31 pm
Posts: 1
I have the same problem and had the same thought for a fix: one-to-many join using a natural key is case-sensitive which I thought I could fix by overriding EqualsHelper to use equalsIgnoreCase() instead of equals() when comparing strings.

Doesn't work. :(

Is there something that will work for this scenario? Another post suggested a subclass of org.hibernate.type.StringType and then override the get() method to return the string value as all uppercase. This works for my specific problem, but I would have preferred overriding the EqualsHelper method. I'm not changing any values retrieved from the db this way.

What say?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.