This is the pseudo code Question - base class MultipleChoice question - Subclass of question AssessmentGroup - 1: n with Question (MultipleChoice and other sub classes of Question are in the same table identified by objconcreteclass)
code Transaction tx - odmg.currentTransaction(); tx.lock (mutliplechoiceobj) db.deletePersistent(multiplechoiceobj) Detailed log shows that MutipleChoice is registered and locked, but the exception says Unexpected behaviour, unregistered object to delete: com.tk20.bo.evaluationinstrument.Question{100007f15c458c10ff4485144-7d2d}, main object is com.tk20.bo.template.AssessmentGroup{100007f15c458c10ff4485144-7d2f}, envelope object is [EMAIL PROTECTED],ModificationState=org.apache.ojb.odmg.states.StateOldDelete] Why does it try to see whether the base class is registered or not? Should it not identify the exact subclass it is I modified the repository_user.xml for mappings for AssessmentGroup <collection-descriptor name="questionsInternal" collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList" element-class-ref="com.tk20.bo.evaluationinstrument.Question" auto-retrieve="true" auto-update="object" auto-delete="object"> <inverse-foreignkey field-ref="assessmentGroupPk"/> </collection-descriptor> Mappings for MutlipleChoice and Question as <reference-descriptor name="assessmentGroup" class-ref="com.tk20.bo.template.AssessmentGroup" auto-retrieve="true" auto-update="none" auto-delete="object"> <foreignkey field-ref="assessmentGroupPk"/> </reference-descriptor> arminw wrote: > > 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 >>> [EMAIL >>> PROTECTED],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 >>> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Inheritence-delete-exception-tf2909729.html#a8187399 Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]