<cfproperty name="focusareas" singularname="focusarea" fieldtype="one-to-many" type="array" cfc="FocusArea" fkcolumn="parentid" cascade="delete" />When I save the parent, I am using an Ajax call and the service proxy uses an entityNew() to create the child, sets its id and other variables and then calls entitySave().
var parent = entityLoadByPK('Parent', arguments.id); parent.setID(arguments.id); parent.setTitle(arguments.title); entitySave(parent);The logical behavior is that entitySave() determines if the record should be inserted or updated. What happens is pretty strange though. Check out the Hibernate log:
Hibernate: update Parent set title=? where id=? Hibernate: update FocusArea set parentid=null where parentid=?The wackiness is that entitySave() does indeed perform an update as opposed to an insert as expected, but then disconnects itself from the child record. If I instead do an entityLoadByPK() and then set all values, everything works as expected. The issue with this is I should not have to check and see if the parent is new and perform an entityNew() or entityLoadByPK() explicitly. This is what ORM does for you. Bug? Thoughts?