-->
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.  [ 1 post ] 
Author Message
 Post subject: PreInsertEventListener and creation of a new member
PostPosted: Tue Nov 01, 2011 12:39 pm 
Newbie

Joined: Tue Nov 01, 2011 12:32 pm
Posts: 1
Hi All,

Im trying to implement a PreInsertEventListener to create an object a that owns an object b.
I try something like this

boolean onPreInsertEvent(PreInsertEvent e) {
if (e.getEntity() instanceof A){
B = new B();
// Set some values in b
e.getEntity().getState[indexForB] = b
((A)e.getEntity()).setB(b);
return false;
}
return true;
}

This results in an Insert for A and an insert For B,
But I was expecting that A now would containg b.id which it does not.

Am I missing something important here, or have anybode else attempted something similar?
It seems to me that A is not dirty, when I actually think it should be.


cheers


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

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.