Hi Pinaki, Thanks for the tips. I think I have the basics now.
Craig On May 26, 2009, at 2:28 PM, Pinaki Poddar wrote:
Hi Craig,So in the case of the relationship field called "a" that refers to an instance of "A", the column is "a_id".Let us say we are loading an instance of B called b. B has a one-to- one relation to A expressed as a field B.a. B.a will be assigned a strategy (inthis case RelationFieldStrategy).1. In course of loading B, JDBCStoreManager has a StateManager(B) and somedata from database. JDBCStoreManager is loading field-by-field of B.2. Now when JDBCStoreManager encounters field B.a, it will call that fieldto load(1246). The field will delegate that call to its strategy. 3. The strategy will effectively call back to the JDBCStoreManager tofind(1234, A.class) -- because strategy knows that 1246 is a reference to aninstance of A.4. JDBCStoreManager.find(1246) will resolve the reference 1246 as a real instance by calling _ctx.find(1246,....). The _ctx is broker. Let us say,broker finds a1 - an instance of A - already in cache with id 1246. 5. Now RelationFieldStreagy(B.a) can set StateManager(b).storeObject(field.index(B.a), a1)I may have missed many a details and important points. But hope that helpsyou to get a more accurate picture of how OpenJPA resolves references. Regards -- Pinaki ----- Pinaki Poddar http://ppoddar.blogspot.com/ http://www.linkedin.com/in/pinakipoddar OpenJPA PMC Member/Committer JPA Expert Group Member -- View this message in context: http://n2.nabble.com/Help-with-StateManager-relationships-tp2976437p2977345.html Sent from the OpenJPA Developers mailing list archive at Nabble.com.
Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:[email protected] P.S. A good JDO? O, Gasp!
smime.p7s
Description: S/MIME cryptographic signature
