[jboss-user] [EJB 3.0] - Database triggers and entity beans

sbivol do-not-reply at jboss.com
Fri Aug 18 17:43:45 EDT 2006


Hi,

We're trying to get rid of few triggers in the database, but are struggling with finding a solution in the ejb3 land. The triggers we're struggling in particular are "after insert" triggers that update other record fields or insert records in same or other tables. 

First, it took us a while to figure out why within the same transaction the entities affected by the trigger would not reflect the data in the database.

Second, we wanted to replace the triggers with java code, and @PostPersist EntityListeners or Callbacks seemed perfect for this, where we thought we could create new entities or find existing ones that need updating, and then use entity manager to persist data. However, we could not find a way to get a handle to the EntityManager.

What is the correct way of doing this?

Also, in a @PostUpdate or @PreUpdate, is there a way to find old AND new values?

Thanks & Regards

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3966176#3966176

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3966176



More information about the jboss-user mailing list