# persistence manager

**URL:** <https://community.ofelia.com/t/persistence-manager/7643>\
**Category:** Q&A\
**Created:** [26 July 2016 11:51 UTC](https://community.ofelia.com/t/persistence-manager/7643 "2016-07-26T11:51:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![patgream](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@patgream](https://community.ofelia.com/u/patgream)\
**Post date:** [26 July 2016 11:51 UTC](https://community.ofelia.com/t/persistence-manager/7643/1 "2016-07-26T11:51:16Z")

</div>

Hi,

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

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [2 August 2016 14:31 UTC](https://community.ofelia.com/t/persistence-manager/7643/2 "2016-08-02T14:31:53Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patgream](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@patgream](https://community.ofelia.com/u/patgream)\
**Post date:** [2 August 2016 15:09 UTC](https://community.ofelia.com/t/persistence-manager/7643/3 "2016-08-02T15:09:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/community_bonitasoft/original/2X/6/6b7b18c0478f2645369e82e009b65e3b97f2cc12.svg) [@system](https://community.ofelia.com/u/system)\
**Post date:** [2 August 2016 15:12 UTC](https://community.ofelia.com/t/persistence-manager/7643/4 "2016-08-02T15:12:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![patgream](https://avatars.discourse-cdn.com/v4/letter/p/b9e5f3/32.png) [@patgream](https://community.ofelia.com/u/patgream)\
**Post date:** [3 August 2016 12:01 UTC](https://community.ofelia.com/t/persistence-manager/7643/5 "2016-08-03T12:01:48Z")

</div>

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
