We migrated from ColdFusion 11 to ColdFusion 2018 and now ORM is breaking the EntitySave
method and we are getting below error message.
Error Message - The root cause of this exception was: coldfusion.orm.hibernate.HibernateSessionException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1.
We have 2 classes with one-to-many relationship like Email.cfc (parent) and EmailItems.cfc (child). When we try to save Email.cfc object the hibernate creates an UPDATE query for EmailItems
as well and this is happening with ColdFusion 2018 only.
Here is the defined property in Email.cfc.
<cfproperty name="EmailItems"
lazy="true"
fieldtype="one-to-many"
inverse="true"
fkcolumn="EmailID"
cfc="EmailItem"
singularName="EmailItem"
type="struct"
structkeycolumn="EmailItemKey"
structkeytype="string"
cascade="none"
/>
We are using inverse and it still create an UPDATE query for child class 'EmailItems' which is the reason for failing EntitySave(Email)
. Everything works fine with ColdFusion 11.