Hello,
I'm using Bonita 7.10 Community edition
I'm trying to store the result of an Oracle query in a business variable. Quite simple to say, but after half-a-day of multiple trials, It still doesn't work and I don't understand why.
My business object :
OMTestErr
ErrIntegrationCode String
ErrFileName String
My pool variable : varTestErr, created after OMTestErr, declared as multiple
The query of the database connector (it's a dummy query, just for testing) :
select e.INT_INTEGRATION_CODE, e.FILE_NAME from ERR_ERRORS e
where e.INT_INTEGRATION_CODE='8083'
For the output, I've first selected "graphical mode" and "n lines x n columns"
in the next screen, I've entered "varTestErr" in the left box.
In the right box "tableResult" cannot be overwritten, which means : "varTestErr takes the value of tableResult".
When I run the process, I get the following error in the engine log :
2020-05-06 17:19:24.603 +0200 INFOS: org.bonitasoft.connectors.database.jdbc.JdbcConnector script select e.INT_INTEGRATION_CODE, e.FILE_NAME from ERR_ERRORS_TB e
where l2.int_integration_code='8083'
2020-05-06 17:19:24.603 +0200 INFOS: org.bonitasoft.connectors.database.jdbc.JdbcConnector separator null
2020-05-06 17:19:24.603 +0200 INFOS: org.bonitasoft.connectors.database.jdbc.JdbcConnector driver oracle.jdbc.driver.OracleDriver
2020-05-06 17:19:24.603 +0200 INFOS: org.bonitasoft.connectors.database.jdbc.JdbcConnector url jdbc:oracle:thin:@XX.X.X.X:XXXX:XXXXXX
2020-05-06 17:19:24.603 +0200 INFOS: org.bonitasoft.connectors.database.jdbc.JdbcConnector outputType table
2020-05-06 17:19:28.718 +0200 GRAVE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=268 | HOSTNAME=MYDESKTOP | TENANT_ID=1 | The work [ExecuteConnectorOfActivity: flowNodeInstanceId = 460056, connectorDefinitionName = recup erreurs integ] failed. The failure will be handled.
2020-05-06 17:19:28.722 +0200 GRAVE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=268 | HOSTNAME=DESKTOP-KA8IUST | TENANT_ID=1 | java.lang.ClassCastException : "class java.util.ArrayList cannot be cast to class org.bonitasoft.engine.bdm.Entity (java.util.ArrayList is in module java.base of loader 'bootstrap'; org.bonitasoft.engine.bdm.Entity is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @a403a42)"
java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class org.bonitasoft.engine.bdm.Entity (java.util.ArrayList is in module java.base of loader 'bootstrap'; org.bonitasoft.engine.bdm.Entity is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @a403a42)
at org.bonitasoft.engine.operation.MergeEntityAction.execute(MergeEntityAction.java:50)
at org.bonitasoft.engine.operation.EntitiesActionsExecutor.executeAction(EntitiesActionsExecutor.java:45)
at org.bonitasoft.engine.operation.BusinessDataAssignmentStrategy.computeNewValueForLeftOperand(BusinessDataAssignmentStrategy.java:45)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:124)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:106)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:95)
at org.bonitasoft.engine.core.connector.impl.ConnectorServiceImpl.executeOutputOperation(ConnectorServiceImpl.java:191)
at org.bonitasoft.engine.connector.ConnectorServiceDecorator.executeOutputOperation(ConnectorServiceDecorator.java:109)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.evaluateOutput(ExecuteConnectorWork.java:127)
at org.bonitasoft.engine.execution.work.ExecuteConnectorOfActivity.evaluateOutput(ExecuteConnectorOfActivity.java:75)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.lambda$executeOutputOperationsAndContinue$1(ExecuteConnectorWork.java:187)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.executeOutputOperationsAndContinue(ExecuteConnectorWork.java:186)
at org.bonitasoft.engine.execution.work.ExecuteConnectorWork.lambda$work$0(ExecuteConnectorWork.java:157)
at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
I have tried to use the script method :
in the operations output definition screen, I've entered :"varTestErr takes the value of script()"
and I've entered the following script :
import groovy.json.JsonBuilder;
import com.company.model.OMTestErr;
List<OMTestErr> errTable = new ArrayList<OMTestErr>();
def jsonb = new JsonBuilder();
while(resultset.next()){
def ligne = jsonb {
ErrIntegrationCode(resultset.getString("INT_INTEGRATION_CODE"))
ErrFileName(resultset.getString("FILE_NAME"))
}
errTable.add(ligne);
}
return errTable;
but the result is just the same.
Thank you for helping me !
Thierry.