Initialization of a Business Variable


I am creating a simple process with Bonita 7.4.3
I have a business variable (books) that is declared as a list of business objects (Book).
I have defined a process contract for this variable and I am initializing it using an auto-generated form and an autogenerated script (below). But the error appears.
Thank you for any suggestion!

The error:
USERNAME=walter.bates | org.bonitasoft.engine.persistence.SRetryableException: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement

It seems like bonita cannot add an object into the list with the autogenerated script:

def bookList = []
//For each item collected in multiple input
//Add a new composed Book instance
bookList.add({ currentBookInput ->
def bookVar = new = =
bookVar.title = currentBookInput.title
bookVar.isAvailable = currentBookInput.isAvailable
return bookVar
return bookList

2 answers


Hi, thank you for the answer.
Yes, I understand that due to some constraint, Bonita cannot write a value to an object.
However, the example seems to be very streightforward and the code (as well as the form for the data entry) are automatically generated by Bonita Studio + UI designer.
The fields - Integer - String - String - Boolean - are entered from the GUI as expected:
Request: {"booksInput":[{"id":1,"author":"Test Author","title":"Test Book","isAvailable":"true"}]}.
None of the fields have a special constraint on it in BDM.
I am not a specialist in Groovy but the script also looks fine.

How can I access the java stack trace for further details?
Thank you!


Submitted by chris.lowth on Tue, 03/21/2017 - 09:16

The java stack trace will (if generated) be seen in the bonita-XXXX.log file.

What does your business_data definition look like, in terms of field types etc? If you export the definition, a file called "" will be created containing a "bom.xml". If it's small, share it here.

Submitted by irina.rychkova_1 on Tue, 03/21/2017 - 17:19


thank you for the help. Will inspect the log...
The business data definition is pretty simple and corresponds to the entered data.
Here is the link on the project.
Will be great to get your insight and help on the problem!
Project archive .bos

Submitted by chris.lowth on Wed, 03/22/2017 - 14:55

You have defined a "uniqueness constraint" on the ID field. That means you cant have two records in the DB with the same ID. Check the table in the database to see whether one exists already or run a web query like the following to view the data in a browser.

Submitted by irina.rychkova_1 on Wed, 03/22/2017 - 15:06

I checked that. Removing the uniqueness constraint does not change the situation. The problem persists.


A constraint violation (which what the error says it is) means that a value breaks a constraint for the field into which its being placed. It might be too long, null (when it shouldn’t be), non-unique, the wrong type (eg: string into an integer) - etc.

The fuller java stack trace might give a clue.