[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Problem with hibernate caching?

DeanoUK do-not-reply at jboss.com
Wed Sep 26 10:09:09 EDT 2007


Hi all.

I have a problem...

I'm trying to retrieve a Survey object from the database which has a one to many mapping onto an object called SurveyQuestion.

There are multiple sets of SurveyQuestions based on locale for each Survey.

Thus I am trying to do this:



  | List<Survey> surveys = entityManager.createQuery("SELECT DISTINCT s FROM " + Survey.class.getSimpleName() + " s LEFT JOIN FETCH s.surveyQuestions q WHERE q.locale = '" + locale + "'").getResultList();
  | 

In an attempt to get back a Survey object which has a set of questions for the given locale.

I do this twice within the same loop, for locale of 'fr' and 'en'.
Both Survey objects contain the 'fr' SurveyQuestions not 'fr' and 'en'.

Am I doing something wrong, or is this some kind of caching problem?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088863#4088863

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088863



More information about the jboss-user mailing list