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.  [ 2 posts ] 
Author Message
 Post subject: Find a newly inserted record in the same transaction
PostPosted: Thu May 05, 2005 11:00 am 
Newbie

Joined: Thu Dec 04, 2003 6:00 pm
Posts: 5
I am using Oracle 9i and have a table that generates the primary key using an insert trigger. In my Java code, I create a new object and save it to the database then, in the same transaction, I want to look up the inserted record by its name field to get the generated primary key. THe idea is

begin transaction
create new object
save object
find object
commit transaction

However, doing a session.find() for the newly inserted object returns no records. Am I doing something wrong, or is this not possible?

Thanks,
David Robison


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 05, 2005 11:56 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
call find after commit - I think that you have to call evict, too


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.