[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-4411) jPDL re-installing its first seam object
Tony Herstell (JIRA)
jira-events at lists.jboss.org
Wed Sep 16 23:47:36 EDT 2009
[ https://jira.jboss.org/jira/browse/JBSEAM-4411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tony Herstell updated JBSEAM-4411:
----------------------------------
Workaround Description:
Since the original user just pops back every time (even if you forcibly set it ti null) then you have to use the one provided regardless.
// HACK HACK as cannot just point the User at the user just returned from the Datastore
User this_user = (User) entityManager.createQuery("from User u where u.email = :email").setParameter("email", credentials.getUsername()).getSingleResult();
this.user.setId(this_user.getId());
this.user.setVersion(this_user.getVersion());
this.user.setLastname(this_user.getLastname());
this.user.setFirstname(this_user.getFirstname());
this.user.setEmail(this_user.getEmail());
this.user.setPasswordHash(this_user.getPasswordHash());
// etc.
A really sub optimal solution as if the object is complex you have to do a deep copy (possibly linking to other objects) and then problem with merge/commit etc.
Workaround: [Workaround Exists]
Ugh horrible workaround found (after 2.5 days of trying to re-write this simple thing many ways)
> jPDL re-installing its first seam object
> ----------------------------------------
>
> Key: JBSEAM-4411
> URL: https://jira.jboss.org/jira/browse/JBSEAM-4411
> Project: Seam
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.2.0.GA
> Environment: WinXP64 MyEclipse JBoss latest RF
> Reporter: Tony Herstell
> Priority: Critical
>
> Given this snippit
> <start-state name="entry">
> <transition name="start" to="getUsersDetails">
> <action expression="#{risingstars.registrationController.initUpdateRegistrationDetails}"></action>
> </transition>
> </start-state>
> <page name="getUsersDetails" view-id="/pages/user/updateUserDetails.xhtml" redirect="true" no-conversation-view-id="/home.xhtml">
> <description>Updating of User (#{risingstars.user.lastname}, #{risingstars.user.firstname})</description>
> <transition name="cancel" to="end" />
> <transition name="next" to="evaluateDetails"/>
> </page>
> I enter the jPDL and the bean has a User in scope... say (say id 123) auto created by
> @In(create=true) @Out(required=true)
> private User user;
> I then do this in initUpdateRegistrationDetails :
> this.user = (User) entityManager.createQuery("from User u where u.email = :email").setParameter("email", credentials.getUsername()).getSingleResult();
> Which forces the user in scope to now point to this new user (say id 456)
> What happens if by the time we get to the next page we have switched back to the original User (123).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list