Miso, Here's what we do: 1. Each normal table comes with a change control id column. The change control is points to a change control table, much like your master audit table. 2. We use triggers to copy the new row to audit/history tables. It is simpler from a query point of view if the audit tables also contain the current data, rather than just the historical data. 3. We use CMP2 to create the master audit record, and update the standard tables. We tend to do this in our session beans, although sometimes, we pass in a change control id as a parameter to a session bean method.
We find this the least invasive method of auditing. Yes, you could do this all in CMP2, but for every write to a base entity, you'd have to insert a new record in an audit table. HTH, Jonathan Miso Pach <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 19.12.2002 18:31 Please respond to jboss-user To: [EMAIL PROTECTED] cc: Subject: [JBoss-user] auditing Hello! I was wondering if someone can provide an insight into what is the best way of auditing oracle (8i/9i) database updates/inserts from within jboss when using CMP beans and conteiner managed transactions. Please follow this scenario: - one jboss transaction updates 3 entity beans - each of the 3 entity beans has a small auditing table associated with it where I want to store the values prior to the update - there is also a master auditing table where I want to record id of the user who did it, location, reason for updating etc. - the small audting tables have a foreign key link to the master auditing table What is the best way to arrange this in jboss? I think I somehow need to find out when a new transaction is started so I can run an insert into the master table. Then I need to make the transaction id available for the updates, so they can create the entries in the small audit tables. I am quite happy to use oracle triggers and oracle variables in global packages etc. The tricky bit is how to pass the extra information that I need in the master audit table and how to link the small audit tables with the foreign key to the master one. I have read here people tried to inherit some jboss interceptors to achieve this. Can anyone share a sample code? Are there any other or better ways? I believe so many people must have solved a similiar people. What did you do? Any replies would be appreciated. thanks! Miso __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com ------------------------------------------------------- This SF.NET email is sponsored by: Geek Gift Procrastinating? Get the perfect geek gift now! Before the Holidays pass you by. T H I N K G E E K . C O M http://www.thinkgeek.com/sf/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ------------------------------------------------------- This SF.NET email is sponsored by: The Best Geek Holiday Gifts! Time is running out! Thinkgeek.com has the coolest gifts for your favorite geek. Let your fingers do the typing. Visit Now. T H I N K G E E K . C O M http://www.thinkgeek.com/sf/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user