We are using Groovy as event in the controller request, everything works fine for us but as we used delegator.find()
it generates the following error
ERROR: Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.
[java] java.lang.Exception: Stack Trace
[java] at org.ofbiz.entity.GenericDelegator.find(GenericDelegator.java:1757) [ofbiz-entity.jar:?]
[java] at org.ofbiz.entity.Delegator$find.call(Unknown Source) [ofbiz-entity.jar:?]
[java] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45) [groovy-all-2.2.1.jar:2.2.1]
[java] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108) [groovy-all-2.2.1.jar:2.2.1]
[java] at ProductInventory$_run_closure1.doCall(ProductInventory.groovy:18) [script:?]
Reason:
Since we are using find method of GenericDelegator.java
As per the code implementation it required the transaction should exist
if (!TransactionUtil.isTransactionInPlace()) {
if not, it generate error
ERROR: Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Solution: initialize the transaction when the groovy is called as event and commit the transaction after the completion.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1740629 13f79535-47bb-0310-9956-ffa450edef68