<br><font size=2 face="sans-serif">Kris,</font>
<br>
<br><font size=2 face="sans-serif">I've attached a simple test case (transaction
manager, data source, etc. are configured via Spring). The error is thrown
on line:</font>
<br>
<br><font size=2 face="sans-serif">ksession.insert(new SimpleFact());</font>
<br>
<br><font size=2 face="sans-serif">If this line is commented out, the rule
flow executes without error.</font>
<br>
<br>
<br>
<br><font size=2 face="sans-serif">Many thanks for looking at this.</font>
<br>
<br><font size=2 face="sans-serif">Regards,<br>
</font>
<br><font size=2 face="sans-serif">Alan</font>
<p>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Kris Verlaenen <kris.verlaenen@cs.kuleuven.be></b>
</font>
<p><font size=1 face="sans-serif">28/10/2009 10:40</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">Alan.Gairey@tessella.com</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">Rules Users List <rules-users@lists.jboss.org></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [rules-users] [droolsflow] Code-based
constraints for EventWait nodes - is this possible?</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Alan,<br>
<br>
Could you send me the entire output / stack trace (as the rollback of<br>
the transaction is usually caused by another exception)?<br>
<br>
Or a simple test case that shows the error, so I can take a look?<br>
<br>
Thx,<br>
Kris<br>
<br>
Quoting Alan.Gairey@tessella.com:<br>
<br>
> Kris,<br>
> <br>
> After posting my last question, I quickly came to the same conclusion<br>
> as <br>
> you, so I'm now using a rule-based constraint in my EventWait node.<br>
> <br>
> This however has presented a different problem. If I create my<br>
> session <br>
> from JPAKnowledgeService, then when I try to insert my fact into the<br>
> <br>
> session, I get the following error:<br>
> <br>
> bitronix.tm.internal.BitronixRollbackException: transaction was<br>
> marked as <br>
> rollback only and has been rolled back<br>
> at <br>
> bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:153)<br>
> at <br>
><br>
bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:96)<br>
> at <br>
><br>
org.drools.persistence.session.SingleSessionCommandService.execute(SingleSessionCommandService.java:258)<br>
> at <br>
><br>
org.drools.command.impl.CommandBasedStatefulKnowledgeSession.insert(CommandBasedStatefulKnowledgeSession.java:305)<br>
> (Everything works fine if I create my session from the knowledge base<br>
> - <br>
> i.e. with no state persistence.)<br>
> Prior to using a rule-based constraint (with no call to <br>
> CommandBasedStatefulKnowledgeSession.insert), the session created<br>
> from <br>
> JPAKnowledgeService worked OK.<br>
> I'm using the default JPA configuration from the Drools documentation<br>
> <br>
> (persisting to H2 database, etc.).<br>
> Any ideas what might be causing the problem?<br>
> Many thanks,<br>
> Alan<br>
> <br>
> <br>
> <br>
> <br>
> Kris Verlaenen <kris.verlaenen@cs.kuleuven.be> <br>
> 23/10/2009 03:00<br>
> <br>
> To<br>
> Rules Users List <rules-users@lists.jboss.org>,<br>
> Alan.Gairey@tessella.com<br>
> cc<br>
> Rules Users List <rules-users@lists.jboss.org><br>
> Subject<br>
> Re: [rules-users] [droolsflow] Code-based constraints for EventWait<br>
> nodes <br>
> - is this possible?<br>
> <br>
> <br>
> <br>
> <br>
> <br>
> <br>
> No, the constraint of an EventWait node (or the State node in Drools<br>
> 5.1) can only be rule-based. The reason for this is that the
rule<br>
> engine knows when to re-evaluates rules (based on the evailable<br>
> input).<br>
> If you would use a code-based constraint, the engine would have
no<br>
> idea<br>
> when this code constraint might become true (if it was false at the<br>
> start). Only constant re-evaluation of the code constraint could<br>
> achieve this (which would be tremendously inefficient). Could
you<br>
> explain why you would like to have this behaviour? Maybe there
is<br>
> an<br>
> alternative way to model this.<br>
> <br>
> To change the value of a variable from inside the process (using an<br>
> action), simply use kcontext.setVariable(name, value). We do
not<br>
> recommend manually changing the value of a process variable from<br>
> outside<br>
> the engine. Again, could you explain why you would like to have<br>
> this<br>
> functionality?<br>
> <br>
> Kris<br>
> <br>
> Quoting Alan.Gairey@tessella.com:<br>
> <br>
> > Can the constraint for an EventWait node in a flow be code-based<br>
> > (rather <br>
> > than rule-based)? The Eclipse plug-in (v 5.0.1) doesn't allow
this<br>
> to<br>
> > be <br>
> > specified, unlike say for a Split node, although the relevant
XML<br>
> can<br>
> > of <br>
> > course be edited.<br>
> > Trying to load such a process flow results in a<br>
> NullPointerException,<br>
> > <br>
> > because the constraint is always interpreted as a rule.<br>
> > <br>
> > Ideally what I'd like to do is have an EventWait node where the<br>
> > constraint <br>
> > tests the value of a process variable. This then leads me to<br>
> another<br>
> > <br>
> > question; is there a way of setting the value of a process<br>
> variable<br>
> > via <br>
> > the Drools Flow API?<br>
> > <br>
> > Thanks in advance for any help,<br>
> > <br>
> > Alan<br>
> > Tessella plc<br>
> > 26 The Quadrant, Abingdon Science Park, Abingdon, Oxfordshire,<br>
> OX14<br>
> > 3YS<br>
> > E: Alan.Gairey@tessella.com, T: +44 (0)1235 555511, F: +44 (0)1235<br>
> > 553301<br>
> > www.tessella.com Registered in England No. 1466429<br>
> > <br>
> > This message is commercial in confidence and may be privileged.
It<br>
> is<br>
> > <br>
> > intended for the addressee(s) only. Access to this message by<br>
> anyone<br>
> > else <br>
> > is unauthorized and strictly prohibited. If you have received
this<br>
> > message <br>
> > in error, please inform the sender immediately. Please note that<br>
> > messages <br>
> > sent or received by the Tessella e-mail system may be monitored<br>
> and<br>
> > stored <br>
> > in an information retrieval system.<br>
> > <br>
> <br>
> <br>
> <br>
> <br>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
> <br>
> <br>
<br>
<br>
<br>
<br>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm<br>
</font></tt>
<br>