I am trying to fetch some data from db with a simple Join in OfBiz. Here is the code placed in a .java method which is invoked from the controller.xml
DynamicViewEntity dve = new DynamicViewEntity();
dve.addMemberEntity("PR", "Product");
dve.addAliasAll("PR", "productName");
dve.addAliasAll("PR", "description");
dve.addRelation("one", "", "ProductAttribute", ModelKeyMap .makeKeyMapList("productId"));
dve.addMemberEntity("PA", "ProductAttribute");
dve.addAlias("PA", "attrName");
// Selected Rows
List selectedFields = UtilMisc.toList("productName", "description");
// Condition
List conditionList = UtilMisc.toList(new EntityExpr("attrName", EntityOperator.LIKE, attr), new EntityExpr("productName", EntityOperator.LIKE, key));
EntityConditionList condition = new EntityConditionList(conditionList, EntityOperator.AND);
EntityListIterator eli = delegator.findListIteratorByCondition(dve, condition, null, selectedFields, null, null);
List result = eli.getPartialList(0, 10);
eli.close();
When running it this is the exception I'm receiving:
Cannot do a find that returns an EntityListIterator with no transaction in place. Wrap this call in a transaction.
At further investigation I found this:
By default, service-multi will wrap one big transaction around all the services, with a timeout set to _rowCount transaction timeout of the service. If you do not want all the service calls to be wrapped in one transaction, use the global-transaction="false" parameter after the invoke="".
So I understand that if I'm not specifying anything there should be a transaction wrapped around my service. What am I missing?