Hi Jean-Yves,

Jean-Yves Sironneau wrote:
Hello,

Yes another question again.

I have a class Area that is referencing a class Point, and Area has a
foreign key constraint on Point.
I'am using ODMG, and i would like OJB to delete the Point when i delete the
Area. What happens is that when i commit a
transaction for removing an Area, OJB is trying to remove the Point but of
course it can't because the foreing key constraint is
violated as the Area is still referencing the point. So i suppose the Area
should be removed first for this to work. Do you think it can
be a bug ? Do i have to manually unreference the point somewhere ?


Do you use auto-delete="object" in Area 1:1 reference-descriptor to Point?
http://db.apache.org/ojb/docu/guides/odmg-guide.html#Specific+Metadata+Settings

If you have problems with the order of persistent objects you can

A. disable ordering and set object order by hand (first delete Area, then Point)
http://db.apache.org/ojb/docu/guides/odmg-guide.html#Disable+OJB%27s+object+ordering%2C+determine+object+order+%22by+hand%22

B. use a workaround to specify the database FK. Simply set a custom property 'constraint' in reference-descriptor of Area.
<attribute attribute-name="constraint" attribute-value="true"/>
http://db.apache.org/ojb/docu/guides/odmg-guide.html#Foreign+Keys+Constraints+and+ODMG-api

If set OJB's ordering try to take care of the database constraint.


Thank you.

Jean-Yves

P.S.:

I'am not a foreign key constraint expert, but i tried to use deferrable=true
for this constraint and it does not work neither.

strange! I would expect that in this case delete ordering is irrelevant.

regards,
Armin

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to