Initialization of a Business Variable

1
0
-1

Hi,
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
booksInput.each{
//Add a new composed Book instance
bookList.add({ currentBookInput ->
def bookVar = new com.company.model.Book()
bookVar.id = currentBookInput.id
bookVar.author = currentBookInput.author
bookVar.title = currentBookInput.title
bookVar.isAvailable = currentBookInput.isAvailable
return bookVar
}(it))
}
return bookList

3 answers

1
0
-1

This article will discuss the initialization of a business variable. Business variables form the backbone of any Excel VBA macro code. Business variables are created to store data that is specific to the application being used and its functionality. If you are essay writing services legal manager then know more about education. They are also referred to as global variables, meaning they can be accessed by all other procedures in the same workbook or by multiple workbooks. In Excel, there are two ways to initialize a business variable:

1
0
-1

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!

Comments

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 "bdm.zip" 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

Hello,

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.
http://localhost:8080/bonita/API/bdm/businessData/com.company.model.Book...

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.
Thanks!

1
0
-1

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.

Notifications