Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Hibernate Exception:Clear is not valid

 
balaji anatha padmanaban
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting the exception
org.hibernate.HibernateException: clear is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:297)
at $Proxy0.clear(Unknown Source)


When i'm using select statement to check the values by using createSQLQuery() method I am getting this.But some times this exception is comming and some times it is working fine.

THe below exception also coming at when I comment the code HibernateUtil.getCurrentSession().clear(); it is present in catch block
Io exception: Got minus one from a read call
Exception: Error saving objectclear is not valid without active transaction


So,please help me to where to clear the
session.
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it just looks like your session has been closed, and you're then calling a method on the HibernateSession that needs to be open.

When does the Session get closed, or does the transaction end? Maybe you don't need that call to clear?

-Cameron McKenzie
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic