Hello:
This is a follow on to my question from last week where I have a graph structure where each graph node has a list of parents and children. I was trying to use the auto-update=object and auto-delete=object features, but it was not working well in my particular scenario (meaning there were not any bugs in OJB) so I am investigating switching to auto-update and auto-delete = none and linking / unlinking on my own.
So here is my question: if I have object A and object B already stored in the database, how can I create or delete an M to N link between them in their indirection table? I know that the BrokerHelper link and unlink methods are the way to go, but I cannot see how to use it because, to me, it looks like you can only specify 1 side of the link.
Here is some rough sample code of what I want to do:
-----------
PersistenceBroker pbroker = PersistenceBrokerFactory.defaultPersistenceBroker();
pbroker.beginTransaction();
pbroker.store(a);
pbroker.commitTransaction();
//then some time later pbroker.beginTransaction(); pbroker.store(a); pbroker.commitTransaction();
//and finally even later
pbroker.serviceBrokerHelper().link(a,b); //I know this method doesn't exist, but this is what I want to do.
// or
pbroker.serviceBrokerHelper().unlink(a,b);
-------------
Here is what the repository file for the DAGNode looks like:
<collection-descriptor name="children" element-class-ref="DAGNode" indirection-table="parent_children_table" auto-retrieve="true" auto-update="none" auto-delete="none" > <fk-pointing-to-this-class column="parent_id"/> <fk-pointing-to-element-class column="child_id"/> </collection-descriptor> <collection-descriptor name="parents" element-class-ref="DAGNode" indirection-table="parent_children_table" auto-retrieve="true" auto-update="none" auto-delete="none" > <fk-pointing-to-this-class column="child_id"/> <fk-pointing-to-element-class column="parent_id"/>
thank you! Brad
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]