-->
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: Need solution for authorize - update/insert in single trans.
PostPosted: Fri Sep 24, 2004 10:52 am 
Newbie

Joined: Fri Sep 24, 2004 10:31 am
Posts: 2
Hibernate version:
2.1.6
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:Oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:

I have a situation like where every record to the table should first go into a audit table where it is moved into main table only after authorization by user other than who inserted/modified it. so, there are eventually two tables with same structure.

eg: Table-1: EMP_MAIN
EID
ENAME
SAL
MAKER_ID
MAKE_DATE_TIME
CHECKER_ID
CHK_DATE_TIME

Table-2: EMP_LOG
EID
ENAME
SAL
MAKER_ID
MAKE_DATE_TIME
CHECKER_ID
CHK_DATE_TIME

During insert, a record will be inserted into log table (EMP_LOG) along with maker_id and make_date_time. checker_id and chk_date_time are null. so, in this case, my mapping is between EMP_LOG and empClass. When authorization is done by other user, checker_id and chk_date_time will be updated in EMP_LOG and then the same record will be moved to EMP_MAIN table. modify and deletion also occurs in the same fashion. All the transaction are done initally in the log table and then moved to main table after authorization.

As the structures of both the tables are same I wanted to make use of same class to map both the tables. remember that initally I want to insert into log table alone. and only on auth, it should be moved to main table. Please provide the mapping or coding solution to achieve insert and auth actions as explained above.

Thanks
-Suresh


Top
 Profile  
 
 Post subject: Need solution for authorize - update/insert in single trans.
PostPosted: Tue Sep 28, 2004 5:19 am 
Newbie

Joined: Fri Sep 24, 2004 10:31 am
Posts: 2
Someone please respond.

Thanks in advance
-Suresh


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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.