Hi list,
this one is tedious, in a framework, we have a model with an abstract entity "Composant" and subentities "Ap" and "Ue" mapped with vertical inheritance.
In one application, this works with no error.
In another app, we have a SQL error when a instance of Ap and Ue are inserted and saved :
----> SQL for AP insertion is OK :
INSERT INTO SCO_SCOLARITE.COMPOSANT(ID_COMPOSANT, CODE, LL_COMPOSANT...
INSERT INTO SCO_SCOLARITE.AP(TYPE_AP_ID, SEUIL, NB_GROUPES...
----> SQL for Ue insertion is not OK :
INSERT INTO SCO_SCOLARITE.COMPOSANT(ID_UE, CODE, LL_COMPOSANT...
It should be ID_COMPOSANT...
So, I took my jd and digged down EOF, here's my found :
when generating SQL, ERXEntity#anyAttributeNamed is called in EOSQLExpression#prepareInsertExpressionWithRow.
In this method, when EOEntity#anyAttributeNamed is called for the attribute 'NeededByEOF0' of AP, it returns the right thing :
<EOAttribute NeededByEOF0
name : 'NeededByEOF0'
definition : 'sco_Composant.id'
className : 'java.lang.Number'
externalType : 'NUMBER'
valueType : 'i'
precision : '38'
>
whereas for the same attribute of UE, it returns null.. and this explains why the primary key of the subentity is taken instead of the one from the parent...
So why it returns null ? The responsible is attribute EOEntity#_attributesToSave which is somehow unset...
Lachlan Deck or anyone, any ideas ?
Any help is appreciated,
Alex