I have an Entity Bean that uses a GUID generator for setting its PKs (rather
than a sequence). I have it working by setting the GUID in the constructor, but
I want to avoid that, so I tried writting a @PrePersist method (see below) that
sets my PK. Now, even though the docs say @PrePersist is called before a SQL
CREATE, JBoss (4.0.3RC1) is throwing an exception with the message "ids for
this class must be manually assigned before calling save()".
BTW, if I set the GUID in the constructor (which, again, I want to avoid) and
place some other stuff in the @PrePersist method, it does get called before the
DB INSERT happens.
Any clues? The method is presented below.
Zorzella
*******************
@PrePersist
public void prePersist () {
setGuid(Guid.generateGUID(this));
}
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3884325#3884325
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3884325
-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user