[jboss-jira] [JBoss JIRA] Commented: (JBSEAM-369) @Create and @Begin(FlushModeType.MANUAL) execute in wrong order

Christian Bauer (JIRA) jira-events at jboss.com
Mon Oct 16 17:48:41 EDT 2006


    [ http://jira.jboss.com/jira/browse/JBSEAM-369?page=comments#action_12345340 ] 
            
Christian Bauer commented on JBSEAM-369:
----------------------------------------

FYI, this also is in FlushMode.AUTO, no @Create:

@Name("register")
@Scope(ScopeType.CONVERSATION)

@Stateful
public class RegisterBean implements Register {

    @In
    private User currentUser;

    @In(create = true)
    private EntityManager caveatEmptorEM;

    @In(create=true)
    private transient FacesMessages facesMessages;

    private String verifyPassword;
    public String getVerifyPassword() {
        return verifyPassword;
    }
    public void setVerifyPassword(String verifyPassword) {
        this.verifyPassword = verifyPassword;
    }

    @Begin(join = true, flushMode = FlushModeType.MANUAL)
    public String enterAccount() {
        System.out.println("################### FLUSHMODE" +
            ((HibernateEntityManager)caveatEmptorEM).getSession().getFlushMode());
        if (
            verifyPasswordMismatch(currentUser.getPassword())
            ||
            usernameExists(currentUser.getUsername())
        ) {
            return null; // Redisplay page
        } else {
            return "profile";
        }
    }
...
}


> @Create and @Begin(FlushModeType.MANUAL) execute in wrong order
> ---------------------------------------------------------------
>
>                 Key: JBSEAM-369
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-369
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>            Reporter: Christian Bauer
>         Assigned To: Gavin King
>            Priority: Blocker
>             Fix For: 1.1
>
>
> This is CVS HEAD:
> @Name("catalog")
> @Stateful
> public class CatalogBean implements Catalog {
>     @In(value = "caveatEmptorEM", create = true)
>     private EntityManager em;
>     @Create
>     @Begin(flushMode = FlushModeType.MANUAL)
>     public void refreshRootCategories() {
>     ...
> }
> The EntityManager is in FlushMode.AUTO because it is injected before the ConversationInterceptor runs and reads the @Begin annotation. 
> So ManagedPersistenceContext.create() runs and sets the flush mode before the setFlushMode() method on the Conversation component is called.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list