[rules-users] [droolsflow] JPAVariablePersister - Multiple Entries for Variables passed into ForEach

Bill Tarr javatestcase at yahoo.com
Thu Oct 29 00:59:05 EDT 2009


Kris,

Yes, these is indeed a subflow within the ForEach.  
 
I suppose that makes sense, I was surprised since the outer workflow doesn't use Role, but OK.

There is another problem with this scenario though (I didn't notice it when I originally posted.)

I am only creating two Role @Entity, but the process creates a third Role.
 
Oddly, this happens right after the first Doc Workflow ends.  Here is the console output:
 
Restoring JPAPersistedVariable id=4 entityId=1 class=com.csatp.svc.rulesmgr.claim.Role value=null
>>>>> Restoring variable role = com.csatp.svc.rulesmgr.claim.Role @ ac64f977
 
Doc Reviewed Event id=16
Doc Reviewed Join id=17
Set Complete id=22
End id=3
 
Restoring JPAPersistedVariable id=2 entityId=1 class=com.csatp.svc.rulesmgr.claim.Role value=null
>>>>> Restoring variable role = com.csatp.svc.rulesmgr.claim.Role @ 25ed8c3e
 
Restoring JPAPersistedVariable id=1 entityId=1 class=com.csatp.svc.rulesmgr.claim.Claim value=null
>>>>> Restoring variable claim = com.csatp.svc.rulesmgr.claim.Claim @ cf2b0901
 
Variable claim -> Updating external Entity = com.csatp.svc.rulesmgr.claim.Claim @ cf2b0901
Saving JPAPersistedVariable id=1 entityId=1 class=com.csatp.svc.rulesmgr.claim.Claim value=com.csatp.svc.rulesmgr.claim.Claim @ cf2b0901
<<<<< Persisting variable claim = com.csatp.svc.rulesmgr.claim.Claim @ cf2b0901
 
Variable 3:3:role -> Persisting external Entity for the first time =com.csatp.svc.rulesmgr.claim.Role @ b084ee4d
Saving JPAPersistedVariable id=3 entityId=3 class=com.csatp.svc.rulesmgr.claim.Role value=com.csatp.svc.rulesmgr.claim.Role @ b5a3782a
<<<<< Persisting variable 3:3:role = com.csatp.svc.rulesmgr.claim.Role @ b5a3782a

Notice that last output.  There was no entityId=3, it just created one.

I've attached two SQL Server screen shots,
1. Right before this event fires (which causes the first Doc Workflow to complete)
    session.signalEvent("DocReviewedEvent", null, 2);
 
2. Right after second doc flow ends.  Notice:
    a. JPAVariablePersister id=2 for Role now has NULL processId
    b.. The "extra" Role is now there
 
Incidentally, the extra Role does not go through the workflow, but stays in "Initial Request" status.
 
The ForEach will still complete after the second Role completes its workflow.
 
Let me know if you think this is a bug, and I will write a test app for this and enter a JIRA.
 
As always, thanks for your assistance!

 
Bill



----- Original Message ----
From: Kris Verlaenen <kris.verlaenen at cs.kuleuven.be>
To: Rules Users List <rules-users at lists.jboss.org>; Bill Tarr <javatestcase at yahoo.com>
Cc: rules-users at lists.jboss.org
Sent: Wed, October 28, 2009 12:21:06 PM
Subject: Re: [rules-users] [droolsflow] JPAVariablePersister - Multiple Entries for Variables passed into ForEach

Bill, 

Is it possible that your ForEach is starting a subprocess where there
also is a process variable role?

Looking at the screenshot, it appear you are indeed persisting the same
Role twice (leading to two JPAPersistedVariables), both referring to the
same entity (id=1).  But the processId seems to be different, and the
name of the variable as well, which seems to indicate that the variable
is persisted in separate processes.  In that case, it would make sense
to have two JPAPersistedVariables.

Kris

Quoting Bill Tarr <javatestcase at yahoo.com>:

> I'm seeing some strange behavior in the JPAPersistedVariable.
>  
> In this case, my Claim has 2 Role objects.  So my Claim workflow has
> a ForEach, passing in a Role to each.
>  
> Here is the console output, notice the same Role @Entity having
> JPAPersistedVariable objects added for them twice.
> 
> Variable claim -> Persisting external Entity for the first time
> =com.csatp.svc.rulesmgr.claim.Claim @ 3881fab4
> Saving JPAPersistedVariable id=1 entityId=1
> class=com.csatp.svc.rulesmgr.claim.Claim
> value=com.csatp.svc.rulesmgr.claim.Claim @ 51414b4
> <<<<< Persisting variable claim = com.csatp.svc.rulesmgr.claim.Claim
> @ 51414b4
>  
> Variable 3:2:role -> Updating external Entity =
> com.csatp.svc.rulesmgr.claim.Role @ a87f09d8
> Saving JPAPersistedVariable id=2 entityId=1
> class=com.csatp.svc.rulesmgr.claim.Role
> value=com.csatp.svc.rulesmgr.claim.Role @ a87f09d8
> <<<<< Persisting variable 3:2:role =
> com.csatp.svc.rulesmgr.claim.Role @ a87f09d8
>  
> Variable 3:3:role -> Updating external Entity =
> com.csatp.svc.rulesmgr.claim.Role @ b3ee9f8b
> Saving JPAPersistedVariable id=3 entityId=2
> class=com.csatp.svc.rulesmgr.claim.Role
> value=com.csatp.svc.rulesmgr.claim.Role @ b3ee9f8b
> <<<<< Persisting variable 3:3:role =
> com.csatp.svc.rulesmgr.claim.Role @ b3ee9f8b
>  
> Variable role -> Updating external Entity =
> com.csatp.svc.rulesmgr.claim.Role @ a87f09d8
> Saving JPAPersistedVariable id=4 entityId=1
> class=com.csatp.svc.rulesmgr.claim.Role
> value=com.csatp.svc.rulesmgr.claim.Role @ a87f09d8
> <<<<< Persisting variable role = com.csatp.svc.rulesmgr.claim.Role @
> a87f09d8
>  
> Variable role -> Updating external Entity =
> com.csatp.svc.rulesmgr.claim.Role @ b3ee9f8b
> Saving JPAPersistedVariable id=5 entityId=2
> class=com.csatp.svc.rulesmgr.claim.Role
> value=com.csatp.svc.rulesmgr.claim.Role @ b3ee9f8b
> <<<<< Persisting variable role = com.csatp.svc.rulesmgr.claim.Role @
> b3ee9f8b
>  
> I've attached a screenshot of my SQL Server, lets see if it gets
> scrubbed out...
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 




Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: afterdocends.bmp
Type: image/bmp
Size: 51462 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20091028/48facaf3/attachment.bmp 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: beforedocends.bmp
Type: image/bmp
Size: 48662 bytes
Desc: not available
Url : http://lists.jboss.org/pipermail/rules-users/attachments/20091028/48facaf3/attachment-0001.bmp 


More information about the rules-users mailing list