[jboss-user] [EJB 3.0] - ID-Handling
hamtho2
do-not-reply at jboss.com
Mon Jan 22 05:38:56 EST 2007
Hi @all,
I have the following scenario: I´ve got a user-object that gets it´s ID through a @SequenceGenerator. Inside this user-object I´ve got an object VerificationCode. The ID of the VerificatinCode should be the same as the ID of the user, but the problem is, that I receive the id only while persisting, so I cannot instantiate the VerificationCode with a User-object and use it´s id with my getId()-method. One solution I found was to use the @PrePersist and do a MyVerificationObject.setId(myUserObject.getId()) in this method. But is this the way to go or is there a more elegant (object-oriented) way?
Thanks
Thomas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004773#4004773
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004773
More information about the jboss-user
mailing list