Patrick van Kann wrote:
> 
> Hello Mark,
> 
> I have also noticed that you don't map the relationship
> bi-directionally. Castor requires your A class to have a collection of
> Bs and your B class to have a collection of As. You must explicitly add
> the As to the Bs and vice-verse (this can be done in the addXXXXX()
> method within the persistent class to save you remembering in the client
> code).


I'm sorry, but I'm not sure how this applies to my problem?  I'm having
trouble persisting a relationship because it thinks that the B objects
that I'm getting from some long transaction are not within the current
transaction context, and therefore not persistable.

Are you saying that by making the relationship bi-directional Castor
will then accept that the B objects are within the current transaction
context?

BTW, can anyone explain what Castor means by "within the current
transaction context" and how long transactions cross this boundary?  I'm
pretty sure that all the magic happens within ClassMolder, I just can
seem to follow what's happening.


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?

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:

User
----
id

Stocks
------
id

Bridge
------
userId
stockId


I want to do User.getStocks() and get back a collection of stockId's
rather than Stock objects.  Is this possible?


Thanks,
-Mark

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

Reply via email to