How to save date with business object aggregation relation?

How to save data in h2 database with business objects aggregation relation?

this is .bos:
https://drive.google.com/file/d/1zkiTYlwlfDI51E_LQPf8JnEJRE8Y0nQD/view?usp=sharing

after execution of this process , there are no data in H2 database?

Ps:
with business objects composite relation, i can found data in h2 but i need to use business object aggregation relation?

hi,

aggregation relation mean that attribute of this type must exist prior to add them.

in your .bos, object msh & pid must exists before your process start.
use a dedicated process to create them, and then retrieve their internal id using a BDM query of your choice.

see Define and deploy the Business Data Model (BDM) | Bonita Documentation for more information

def adA04Var = new com.company.model.AdA04()
adA04Var.ada04seg = {
//Retrieve aggregated Segment using its DAO and persistenceId
def segmentVar = segmentDAO.findByPersistenceId(adaInput.ada04seg.persistenceId.toLong())
segmentVar.msh1 = {
//Retrieve aggregated Msh using its DAO and persistenceId
def mshVar = mshDAO.findByPersistenceId(adaInput.ada04seg.msh1.persistenceId.toLong())
mshVar.attribut1 = adaInput.ada04seg.msh1.attribut1
return mshVar}()
segmentVar.pid1 = {
//Retrieve aggregated Pid using its DAO and persistenceId
def pidVar = pidDAO.findByPersistenceId(adaInput.ada04seg.pid1.persistenceId.toLong())
pidVar.attribut3 = adaInput.ada04seg.pid1.attribut3
return pidVar}()
return segmentVar}()
return adA04Var

thanks laurent;
please, have you any example (to set the business variable attributes values )?