openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Help with StateManager relationships
Date Tue, 26 May 2009 18:43:20 GMT
Hi,

I'm working on a back end for OpenJPA that has relational and non- 
relational access paths. I'm extending JDBCStoreManager so I can do  
some work via the relational path and some via the non-relational path.

I'm currently stuck on relationship handling.

I have a simple one-many relationship expressed as a column on the  
many side that is a foreign key to the one side. What I don't quite  
get is how the StoreManager is supposed to interact with the  
StateManager. I read the javadoc:

The fetchXXXField and storeXXXField methods can be used to get and set  
fields of the managed persistent object. Most back-end code, however,  
should use the similar fetchXXX and storeXXX methods in place of the  
field methods. These methods function just like the field methods, but  
also pass the value through the externalizer and factory the field may  
have.

So in the case of the relationship field called "a" that refers to an  
instance of "A", the column is "a_id". Is the relationship handling  
supposed to be done by the externalizer, or by the StoreManager  
knowing what to do with the foreign key handling?

A few pointers to where the code implements the relationships would  
help. I've tried to read the JDBCStoreManager for inspiration but it's  
a bit opaque to me at the moment. I can't seem to find much on the  
interaction of StateManager and StoreManager in any of our docs.

Thanks,

Craig

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message