How about directly modeling your audit tables with cmp2?
On 2002.12.19 13:31:33 -0500 Miso Pach wrote: > 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. There is no provision for notification on new transactions, and it might be difficult to separate those for events of interest in your app and those of for instance other apps. Also, although xids are in fact currently created using a incremented number, this is really a hidden detail, and before jboss 4 these numbers repeat on jboss restart. You could probably most easily make an XidFactory that would notify you on new tx. > > 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. Indeed. That's why I think using cmp2 is worth a look. david jencks > > 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: 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