0 Replies Latest reply on Sep 26, 2007 10:09 AM by Dean Pullen

    Problem with hibernate caching?

    Dean Pullen Novice

      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?