-->
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: how can i get the row count affacted in a trasaction
PostPosted: Tue Jun 05, 2007 11:55 am 
Newbie

Joined: Fri May 11, 2007 5:19 am
Posts: 2
Hibernate 3.2.3

MySql 5.0.41

hi, everyone,
i'm developing a project that needs to log every db operation into a table, for example, the log table maybe look as follows:

tb_name | oper_type | row_affacted
---------------------------------------------------
tb_user | insert | 1
tb_address | update | 3
---------------------------------------------------
that means i update 3 rows in tb_adderss and insert 1 row into tb_user in one transaction.

one solution is that i count the objects get from front-end and treat that as "row_affacted", but there is chance that may be one object is already in the tb_address.
for example: i get one TbUser, three TbAddress, but finally i only insert 1 into tb_user and update 2 for tb_address.

i also think about the trigger, but the trigger for Mysql is based on row level, which means i'll get TWO single line in log table for tb_address with the "row_affacted" as "1".

there is also a way that i can compare the objects with the records in the table to determine which operation will take, but isn't that too complicated??

is there a way i can get the table & row count DIRECTLY from the session?

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.