display Count(*) result

1
0
-1

I would like to display the numner of reocrds in adatabase table by using the 'Select count() from databasetable" possibility. I have created a working connector to an oracle database and when testing the connector the output shows nicely "BigDecimal: 86" which is correct. In the connector output operation definition is count() linked to an iteger field 'users'. Running the model results however in the following error: | CONNECTOR_INSTANCE_ID=14 | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.data.instance.exception.SUpdateDataInstanceException: Impossible to update data instance 'users': org.bonitasoft.engine.services.SPersistenceException: Problem while updating entity: org.bonitasoft.engine.data.instance.model.impl.SIntegerDataInstanceImpl@357e5014 with id: 26" 2014-06-18 09:48:13 org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bonita].[jsp] FINE: Disabling the response for futher output

Would it be possible for you to give me an idea what the correct way is to get the results displayed?

Comments

Submitted by mehdi.kettani on Thu, 06/19/2014 - 16:06

Hello RVermeulen,

The problem is that the count retrieved by your connector is returned to you as a java.sql.ResultSet object. This java object cannot be stored in the integer data "users" like this. Either you use a groovy script to access the only integer value in your resultset object like this :

if(resultset != null){ if (resultset.next()){ return resultset.getInt(1); } }

or you can use the BonitaDBTools available here : http://community.bonitasoft.com/project/bonita-bpm-development-tools

if you are in bonita 6.x

Regards,

Mehdi

Submitted by RVermeulen on Thu, 06/26/2014 - 15:12

the groovy script is working fine. Thanks for your help.

No answers yet.
Notifications