[jboss-user] [EJB/JBoss] - Re: EntityManager merge and the seam-registration example.
do-not-reply at jboss.com
Thu Sep 14 20:00:17 EDT 2006
I know this is a late reply, but...
Section 3.7 of the hibernate docs tells you that if the id is null (transient object), then it will persist, but if the id is populated (detached object) then it will merge.
You have a transient object.
Do you have the app populating the register form with an existing employee, or are you just trying to type in the name of an existing user, hoping that it will update the info? I'm guessing you're trying to do the latter and that's why it isn't doing what you want.
You'll probably need to add a search screen that finds all the users, allows you to select one (using DataModel/DataModelSelection) then populates the form for you (by using @Out to outject the user). You'll also have to make sure that the search selection starts a conversation (@Begin) and the update feature ends the conversation (@End) because you are spanning multiple requests. Make sure the user object has conversation scope (the default for entity beans, so don't define the @Scope annotation).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3971776#3971776
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3971776
More information about the jboss-user