Re: Inheritence delete exception
Armin Waibel <[email protected]>
| Newsgroups | gmane.comp.jakarta.ojb.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
mananthakris wrote:
> I checked that our repository_user file does not contain auto_XXX for an
> reference-desc and collection-desc, are these mandatory and could be cause
> of problems?
>
It seems that OJB can't find the Question object in intern object
registry using it's Identity. OJB detect that the object no longer
exists in the 1:n reference and try to remove the Question object.
To enable cascading delete it's mandatory to set auto-delete="object".
http://db.apache.org/ojb/docu/guides/odmg-guide.html#Specific+Metadata+Settings
Could you please post the used source or pseudo code?
regards,
Armin
> mananthakris wrote:
>> Hi,
>>
>> We are using same table for different subclasses using a varchar column
>> and define ojbConcreteClass to find the actual class.
>>
>> When we try to delete a object in a relationship , i see an error
>> "unregistered object for delete:" . I saw a previous forum question,
>> suggestion for the error and implemented writing locks for all objects in
>> transaction, but we still have the error.
>>
>> In our case we have an object AssessmentGroup and an object Question in
>> 1:n relationship ( Question has different types of questions /subclasses
>> in a same table differentiated with classidentity column of the table).
>>
>> This error occurs when we delete a MultipleChoice sublclass of Question
>> and remove its relationship with AssessmentGroup.
>>
>> Detailed logs shows we are locking
>> AssessmentGroup,MultipleChoice(subclass) before delete,
>>
>> but the exception shows even when we are writing
>> db.deletePersistent(multiplechoiceobj) , it is trying to delete base class
>> internally. Do you think this is expected behaviour? Are we supposed to
>> lock base class inspite of knowing which exact class we are deleting?
>>
>> The exception is
>>
>> org.apache.ojb.odmg.Image$ImageException: Unexpected behaviour,
>> unregistered object to delete:
>> com.tk20.bo.evaluationinstrument.Question{100007f1388e5e10fe3fa0849-7ff1},
>> main object is
>> com.tk20.bo.template.AssessmentGroup{100007f1388e5e10fe3fa0849-7ff3},
>> envelope object is
>> org.apache.ojb.odmg.ObjectEnvelope@10a5314[Identity=com.tk20.bo.template.AssessmentGroup{100007f1388e5e10fe3fa0849-7ff3},ModificationState=org.apache.ojb.odmg.states.StateOldClean]
>>
>>
>> We are using obj 1.0.4 odmg api with mysql db.Attached is the
>> repository_user.xml
>> http://www.nabble.com/file/5190/repository_user.xml repository_user.xml
>>
>