OK, which RDBMS are you
testing on? What are the target platforms for your product?
I think I'm right in saying that not all RDBMS
have before and after triggers. Certainly the implementations are quite different.
You could use a stored procedure and manage the transaction within it but that limits your potential target platforms and more-or-less requires you to write the code separately for each one. You get the same problem with triggers though. There are two performance advantages of the SP route: 1) the SQL is pre-compiled; 2) all processing is done on the DB minimising network latency and context-switching overhead.
The only way I can see to achieve what you want and remain totally platform-neutral is to run the query you want in your "trigger" from the
Java after the commit returns. Is there an issue with doing it that way?
Regards
Jules