• Post Reply Bookmark Topic Watch Topic
  • New Topic

hibernate session returning old values  RSS feed

 
D kukreja
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • 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();
 
Scott Johnson
Ranch Hand
Posts: 518
  • Mark post as helpful
  • send pies
  • 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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!