How to implement features of a Trigger in Java Program
Hi,
I need help for implementing a Java program which acts as a trigger. The Java program should act as a listener and when some update, insert or delete happens in a database table, this Java program should be able call some other class. If anybody can help me on this, it would be greatful.
Thank you
Regards
Anoop
Try to do it in the class where you are doing the update, insert or delete operation.... i.e. at the level of the application that is interacting with the database... it will be a lot easier... as soon as you do a database change, call the desired class object or something of that sort...
> But how the class will know when an update happened
> in database. It should be continuosly looking the
> table for update right? can u provide some kind of an
> algorithm for wat u suggested.
M sorry, but you just did not get what I said... You have to invoke when you are updating the database... i.e. the class which is updating acts as the trigger...
Actually I won't be having access to the class that is updating database. Some class will update the database, but the new class am going to write should be listening that table whether any updates are happening. Sorry if i didn't conveyed it properlyThank you