-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: getCurrentSession and openSession
PostPosted: Fri Nov 08, 2013 5:50 am 
Newbie

Joined: Thu Sep 26, 2013 7:31 am
Posts: 3
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.