• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

hibernate session returning old values

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a Date column in a table which is read by hibernate.
Hibernate is executing a query to take all the columns for the field. This gives correct result sometimes and when it is run continously for several times it give wrong value. When I run the query directly in the DB2 control center, it returns the right values.
Heres my custom method to get the data from DB2.

String queryString = "from Blind as model where model.productlisting = ? and model.blindtype = ?";
Query queryObject = getSession().createQuery(queryString);

queryObject.setParameter(0, productlisting);
queryObject.setParameter(1, blindType);

return (Blind) queryObject.uniqueResult();
 
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It sounds like the result is getting cached in the query cache.

Do you have the Hibernate query cache enabled? Set this query to be non-cacheable and see if the problem disappears. For more information read section 19 of the Hibernate documentation.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"D kukreja",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
reply
    Bookmark Topic Watch Topic
  • New Topic