Hi ,
When I tried to use sessionfactory.getCurrentSession , I'm getting an exception(@ this point
session.createSQLQuery("SELECT *).
After I have replaced sessionfactory.getCurrentSession with sessionfactory.openSession , it started working perfectly fine
Exception which I have got after implimenting sessionfactory.getCurrentSession
Quote:
org.hibernate.HibernateException: createSQLQuery is not valid without active transaction
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:341)
at com.sun.proxy.$Proxy31.createSQLQuery(Unknown Source)
at com.fritolay.hdcd.dao.EventsdaoImpl.eventList(EventsdaoImpl.java:41)
at com.fritolay.hdcd.service.EventsServiceImpl.eventList(EventsServiceImpl.java:21)
at com.fritolay.hdcd.controllers.EventControler.getAllEvents(EventControler.java:44)
So my question is what is the basic diffrence between getCurrentSession and openSession ?
Which option is recomended(Perfomance)
Note : I'm trying to do a perfomance tuning in my module by implimenting @Autowire.
Thanks in advance