[
https://jira.jboss.org/jira/browse/JBSEAM-4411?page=com.atlassian.jira.pl...
]
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.
and Another one....
/**
* Outject a mode of operation for pages to act on.
*/
// HACK HACK as for some reason we lose a Mode mode; but don't "lose"
and injected bean that simply contains the Mode mode.
@In(create=true) @Out(required=true)
private CrudsController crudsController;
@Local
public interface CrudsController extends Serializable {
public void setMode(Mode mode);
public Mode getMode();
public void destroy();
}
@SuppressWarnings("serial")
@Name("risingstars.crudsController")
@Stateful
public class CrudsControllerImpl implements CrudsController, Serializable {
/**
* Inject and leverage the Seam Logger.
*/
@Logger
private Log log;
public Mode mode;
public void setMode(Mode mode) {
this.mode = mode;
}
public Mode getMode() {
return this.mode;
}
@Remove
@Destroy
@Override
public void destroy() {
log.info("> destory");
log.info("< destory");
}
}
was:
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.
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