-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: EntityListener and associations
PostPosted: Thu Oct 05, 2006 2:21 am 
Newbie

Joined: Thu Oct 05, 2006 2:04 am
Posts: 3
I use the Hibernate EntityManager (+ Hibernate Annotations).
I have registered an EntityListener for my data model. If i change simple attributes from an entity, the EntityListener woks fine and "alert". But if there are changes in an association, nothing happens.
For example:
Entity [i]A[/i] has an [i]@ManyToMany[/i] association to Entity [i]B[/i] and i add an object to the collection und make this persistent, the changes are made in the db (new entry in the association table and new entry in table for [i]b[/i]). But: the EntityListener doessn't "alert". Why is this? Is this the right behavior? Are there other possibilities for notifying a listener?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 9:51 am 
Expert
Expert

Joined: Sat Oct 25, 2003 8:49 am
Posts: 490
Location: Vrhnika, Slovenia
Alert?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 05, 2006 10:25 am 
Newbie

Joined: Thu Oct 05, 2006 2:04 am
Posts: 3
With "alert" I mean: do something, for example make a console output.

puplic class ModelListener(Object entity) {

@PostPersist
@PostUpdate
@PostRemove
public void alert() {
System.out.println(entity.getClass().getName());
}


}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.