[jbossseam-issues] [JBoss JIRA] Updated: (JBSEAM-1678) @Begin(flushMode=MANUAL) takes effect AFTER method call instead of before it.

Pete Muir (JIRA) jira-events at lists.jboss.org
Mon Mar 10 08:58:58 EDT 2008


     [ http://jira.jboss.com/jira/browse/JBSEAM-1678?page=all ]

Pete Muir updated JBSEAM-1678:
------------------------------

    Fix Version/s: 2.1.0.GA

We should definitely consider this. The current situation is semantically correct in terms of conversations BUT isn't obvious from a user's POV.

> @Begin(flushMode=MANUAL) takes effect AFTER method call instead of before it.
> -----------------------------------------------------------------------------
>
>                 Key: JBSEAM-1678
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1678
>             Project: JBoss Seam
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0.BETA1
>         Environment: J2SE 1.5, Tomcat 6.0.10, Hibernate 3.2.3, HibEM 3.3.1
>            Reporter: Frits Jalvingh
>             Fix For: 2.1.0.GA
>
>   Original Estimate: 1 hour
>  Remaining Estimate: 1 hour
>
> (See also the end of thead at http://jboss.com/index.html?module=bb&op=viewtopic&p=4064502#4064502)
> I have a method marked:
> @Begin(flushMode=FlushModeType.MANUAL)
> public String createNewTarget()
> This method is meant as the start of a 2-screen conversation. This conversation should be rolled back if a user presses cancel so flushmode=MANUAL is used to prevent the persistence context from flushing db changes.
> The method starts by creating a new entity and persist()s it. The problem is that this causes an immediate "insert" by Hibernate regardless of the flushmode.
> I debugged the code and found that the flushmode gets set AFTER Seam calls the method, not before (ConversationInterceptor). This seems to be wrong, so I placed an extra call to set the mode in aroundInvoke():
>                setFlushMode(method); 	// JAL FlushMode should be set BEFORE we call the method!?
>                Object result = invocation.proceed();   
>                beginConversationIfNecessary(method, result);
>                endConversationIfNecessary(method, result);
>                return result;
> (flushMode in the original code is set in beginConversation()).
> This at least fixes part of the problem; the other part of the problem is a bug in Hibernate where it always forces an insert even if it is not needed. I fixed that too which fixes the entire problem.

-- 
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 seam-issues mailing list