-->
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.  [ 3 posts ] 
Author Message
 Post subject: DAO code generated by 3.2beta8 not transaction wrapped
PostPosted: Mon Jan 22, 2007 1:21 pm 
Newbie

Joined: Mon Jan 22, 2007 12:41 pm
Posts: 5
Hi,

My generated DAO objects are returning this when called;
"org.hibernate.HibernateException: get is not valid without active transaction"

And I can see that the generated DAO objects do not wrap the call in a transaction, eg;
Applications instance = (Applications) sessionFactory.getCurrentSession()
.get("versioning.Applications", id);

I understood that the recommended practice was to handle the transaction in the code rather than auto-commit, but it seems the generated DAO code is expecting to have auto_commit turned on?

Am I missing something here?

Thanks,

T.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 22, 2007 3:09 pm 
Newbie

Joined: Mon Jan 22, 2007 12:41 pm
Posts: 5
I guess what I am looking for, is when should this work;

Applications instance = (Applications) sessionFactory.getCurrentSession()
.get("versioning.Applications", id);


AS far as I can see, unless something has wrapped a great big transaction around the session, at some point during the servlet initialization or doGet method, then that would always fail....?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 23, 2007 10:43 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
Transaction management should be handled in your service layer, not in DAOs.


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

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.