-->
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: newbie: Using *Home ADO generated by reveng
PostPosted: Sun Aug 20, 2006 10:38 pm 
Newbie

Joined: Sun Aug 20, 2006 10:26 pm
Posts: 1
I'm trying out different things with Hibernate for the first time and I stumbled across the following:

The reveng generated all the POJO classes and thier DAO (nameHome)

After wrestling a bit with jndi I've got working code using HibernateUtil to return the session that is bound on the jndi.

So I can do something simple like this without problem:
Code:
...
SessionFactory sf = HibernateUtil.getSessionFactory();
Session s = sf.openSession();
Transaction t = s.beingTransaction();
Customer c = (Customer)s.get("com.myapp.hibernate.obj", id)
...


I noticed that the CustomerHome generated by reveng doesn't create a transaction, for what I assume it expects the session to be open, and have a transaction assigned already. But I'm failing to see how I need to set that up.

How do I begin a transaction such that is attached to the "CurrentSession"? So I can use something like:

Code:
Customer c = CustomerHome.findByID(id)


Any pointers appreciated!
-p


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.