[jboss-user] [JBoss Seam] - observing database updates

robshep do-not-reply at jboss.com
Sat Dec 1 19:31:38 EST 2007


I'd like to observe the changes being made to persisted entities.

I'm currently using an EntityHome instance for entity management and have something like this.


  | @Override
  | public String update()
  | {  
  |     MyObj old = (MyObj)this.getEntityManager().find(MyObj.class, this.getInstance().getId());
  |     MyObj incoming = this.getInstance();
  |     System.out.println("OLD: " + old.getDescription() + ", NEW: " + incoming.getDescription() );
  |     return super.update(); 
  |     }
  | 

I've seen however, that even though the entity instance isn't persisted through to the underlying DB yet, the entitymanager is being clever and finding the instance coming in from the JSF components.

To enable me to see the differences between the a) the data actually in the DB and b) the data currently known to the entitymanager..... 

I think I need to get hold of a new fresh entitymanager instance, one which doesn't have a cache of anything related.

Please could somebody explain how I may get such an instance. OR, if you have any better places in mind for where I can observe this data flow.

many thanks and kindest regards

Rob

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

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



More information about the jboss-user mailing list