I am trying to saveentity with first table where tables linked with one-to-one relationship on primary key. Here is code that I am trying,
tbl6.cfc
component name="tbl6" persistent='true' accessors="true"{
property name="id" fieldtype="id" generator="native";
property name="col";
property name="tbl7" fieldtype="one-to-one" cfc="tbl7";
}
tbl7.cfc
component name="tbl7" persistent='true' accessors="true"{
property name="tbl7id" fieldtype="id" generator="foreign" params="{property='tbl6'}";
property name="tbl6" fieldtype="one-to-one" cfc="tbl6" constrained="true";
property name="col";
}
index.cfm
<cfscript>
ormreload();
objt6 = entityNew("tbl6",{"col":"tbl6"});
objt7 = entityNew("tbl7",{"col":"tbl7"});
objt6.settbl7(objt7);
objt7.settbl6(objt6);
entitysave(objt6);
</cfscript>
In above case ORM only save record for tbl6, but if I change entitysave argument to objt7 it store record for both table. I am not sure what I am doing wrong here. I am trying this in RAILO 4.1
Please help.
Ah, I got that, I just need to add cascade="all" in property of tbl7 in tbl6.cfc
I just keep question to help others.