Hi VP,
I have found a bug in the ORM mapping files, related to “cascadestyle” setting. I’m using DB-VA 4.1 sp1 20071116a.
When working with a model like the attached image, here are the mapping results:
-
class2.hbm.xml relation with class1 mapping is (omitting details):
<many-to-one … cascade=“save-update” … >
It’s ok!! -
class3.hbm.xml relation with class1 mapping is (omitting details):
<many-to-one … cascade=“save-update” … >
It’s ok!!
But, the mapping for Class1 is:
<one-to-one name=“Class2” … cascade=“all-delete-orphan” … />
<one-to-one name=“Class3” … cascade=“save-update,delete” … />
Oops… it’s not ok :shock:
That last “save-update,delete” produces a PersistentExcepcion when initializing NHibernate. :oops: Combined cascades are not supported in NHibernate 1.2 (I think that they are only on Hibernate 3.x, but not sure).
So, the only available cascade types on NHibernate (.NET) are:
“all”, “all-delete-orphan”, “none”, “save-update”, “delete” and “delete-orphan”
What can we do? Use a less efficient “all-delete-orphan” explicitly on the ORM Association End Detail? or maybe the generator should know about this when building NET code?
bug6.png