Hello Mark, >Are you saying that by making the relationship bi-directional Castor >will then accept that the B objects are within the current transaction >context? > > No, I was merely observing that in order for Castor to work it is required that relationships are bi-directional, and in the code fragment it appeared that they were not, as the field mapping occured only in the A class.
> >To get back to your bi-directionality suggestion, say object A is a User >and object B is a Stock that the user is interested in. The usage of >the objects are such that I would never want to grab the Stock object >and ask it for all users interested in it (Stock.getInterestedUser()). >I would use some OQL query that returned the answer. What would I do in >this case? > That sounds plausible. However, when you call load() on the User, all of the related stocks will be automatically be loaded. Note that when Stocks are loaded, related Users are also loaded which can degrade perfomance (loading a single User could involve the loading of 1000s of objects).. This brings us to your next point.... > >On a related note, I can imagine many situations where all I really want >is a Collection of related id's from the bridging table, rather than the >objects themselves. So in the case of: > This functionality is present in Castor. Read http://www.castor.org/castor-one.html#Lazy-Loading. Note that you need to change your persistent classes to uses a RelationCollection - this will hold only the ids of the related objects until you try and access that object using say, iterator.next(), whereupon it will load the entire object. Hope this helps. Patrick ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
