This one time, at band camp, Mark Koch said:

MK >So by your explanation, I could add depends="jdo.TestMaster" to the mapping
MK >for TestGroup and I should be able to just call create() for the TestMaster
MK >object which contains the TestGroup.
MK >
MK ><class name="jdo.TestGroup"  depends="jdo.TestMaster"  access="shared"
MK >identity="id">
MK >
MK >JDO would then recognize the dependent relationship and create the entry in
MK >the test_group table. ( all above references of course are to the test suite
MK >).   There wouldn't be a need to independently call _db.create(group).
MK >
MK >I've tried to do this, and the group is never inserted.  Am I missing
MK >something?

Mark,

Yes, you're partially correct here. Adding the depends attribute
in the mapping of the class is one thing that is necessary. However,
I've also noticed that the TestGroup does not have a relation back
to the TestMaster. There are certain situations where Castor will
not completely enforce it, but Castor requiress bi-directional
relationships. Meaning that if TestMaster contains a relation to
TestGroup (and I've noticed that it does contain one - it's called
_group) then TestGroup must also contain a reciprocal relation to
TestMaster (I've notice that this is missing). I haven't dug that
deep but it seems to me that the relation in TestMaster to TestGroup
needs to be added.

I hope I didn't completely confuse you there. Please see
http://castor.exolab.org/castor-one.html#Dependent-and-related-relationships.
Also see http://castor.exolab.org/jdo-faq.html#Technical-questions
under the heading 'Can Castor automatically create/remove related
objects?' The one thing that is not explicitly mentioned in any of
the docs (not that I know of anyway) is the notion of bi-directional
relationships. Simply if object A refers to Object B, then Object
B must refer to Object A. Like I said, there are circumstances where
Castor does not strictly enforce this, but it's safer to model
bi-directional relations that not to.

Bruce
--

perl -e 'print unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to