persistence manager

1
0
-1

Hi,

Is it possible to access BDM persistence manager to force insert or update in a groovy script ?

2 answers

1
0
-1

Thanks Lio,

Originally i wanted to add an item to a container in connector out. The item is set in an activity, the activity can loop so the connector check if the item already exist in the container and if not add it. I understood that bo can only manipulate at init or in operations (operations are performed in a transaction), so i used a work around : i add all item to the container at init.

Regards

Comments

Submitted by Lionel Palacin on Tue, 08/02/2016 - 17:12

Hi,

You can manipulate the BO in a connector as well, just make sure you return the updated bo and replace the current one in the last screen of the connector "Output operations".

Cheers

Submitted by patgream on Wed, 08/03/2016 - 14:01

Hi Lio,

I don't think so, to manipulate you must be in transaction and only operations are executed in transaction. We I try to execute the code below in connector I have the following exception.

Caused by: java.lang.IllegalStateException: org.bonitasoft.engine.transaction.STransactionNotFoundException: No active transaction.
at org.bonitasoft.engine.business.data.impl.JPABusinessDataRepositoryImpl.getEntityManager(JPABusinessDataRepositoryImpl.java:174)
at

Code :

if (currentContratReview.getItemLst().contains(currentContratReviewControlFactory)==false)
currentContratReview.getItemLst().add(currentContratReviewControlFactory);
return currentContratReview;

and result is affect to currentContratReview

1
0
-1

Hi Pat,

I don't think you can access the Persistence manage in a Groovy script.

What is your use case? You can easily access the bdm variable managed by your case to update them, they should be available in the left dropdown list "select variable" in the Groovy script editor.

Cheers Lio

Notifications