hibernate - Issue with getHibernateTemplate.saveOrUpdate -
hi using hibernate 3.0
facing issue data saving.
in below code client pojo want save. though tried flush still same problem
try { gethibernatetemplate().saveorupdate(client); system.out.println("this executed"); gethibernatetemplate().getsessionfactory().getcurrentsession().flush(); } catch (dataaccessexception e) { // todo auto-generated catch block e.printstacktrace(); } catch (hibernateexception e) { // todo auto-generated catch block e.printstacktrace(); }
getting following exception
org.hibernate.hibernateexception: no hibernate session bound thread, , configuration not allow creation of non-transactional 1 here @ org.springframework.orm.hibernate3.springsessioncontext.currentsession(springsessioncontext.java:63) @ org.hibernate.impl.sessionfactoryimpl.getcurrentsession(sessionfactoryimpl.java:574) @ com.hewitt.appinv.dao.clientdaoimpl.saveclient(clientdaoimpl.java:118)
you should use
hibernate.current_session_context_class = thread
for session , use this
hibernate property<prop key="hibernate.current_session_context_class"> ${hibernate.current_session_context_class} /prop>
Comments
Post a Comment