I was working on a script that saves a User Record, which produces the following error from a user perspective:
'There was an error while accessing the database'
When looking at the logs it shows this:
Caused by: java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: RecordCustomFieldPossibleValue#null. Order: 0.
I have pinpointed out that the field type that is causing the error is a single selection field (when I comment the line that adds the field to the Record objet the error dissapears). The relevant portion of the script is the following:
Code: Select all
def currencyPossibleValue = new RecordCustomFieldPossibleValue()
currencyPossibleValue.internalName = currencyInternalName
currencyPossibleValue.field = new RecordCustomField()
currencyPossibleValue.field.internalName = scriptParameters.recordInternalName
def recordType = entityManagerHandler.find(UserRecordType, recordTypeName)
def newParams = new RecordDataParams([user: new UserLocatorVO(id: user.id),
recordType: new RecordTypeVO(id: recordType.id)])
def dto = recordService.getDataForNew(newParams).getDto()
wrapped[currencyField] = currencyPossibleValue
recordService.save(dto)
#######################################################
Minor Bug report
-------------------------------------------------------
Cyclos version: 4.15.13
Project: Web_new
User: Member
Menu: Banking > Operations
Installation(s): Installation on own server
-------------------------------------------------------
Description:
When trying to save a new User Record that has a Single Selection field I get the following error: There was an error while accessing the database
-------------------------------------------------------
URL: https://osher.360vew.com/
Username: edwinadmin
Password: Time#75500
-------------------------------------------------------
Error log: Caused by: java.lang.IllegalStateException: During synchronization a new object was found through a relationship that was not marked cascade PERSIST: RecordCustomFieldPossibleValue#null. Order: 0.
#######################################################