Hi Rick,

Rick Sanderson wrote:
I'm new to OJB, so I might be missing something.

It seems that OJB requires domain classes with associations to other classes to contain an "oid" member (with getter/setter) in addition to the object reference (with getter/setter). Is this true?
yes and no!
yes, for each foreign key in your database you must have a matching (private) attribute in your domain class!

No, there is no need for public getters/setters. If you are using the PersistentFieldDefaultImpl OJB uses reflection to access attributes.


For example (from the tutorials), an Article has a ProductGroup
reference, but the Article class needs to hold an int for the
ProductGroup id as well as the ProductGroup member for the object
reference itself.

I can see this getting very messy for complex object graphs.

I don't think that this is a real problem.
You can hide those "technical" attributes by not providing getters and setters on them, so only OJB will use them, but not the users of your domain class.

Also commercial O/R tools like toplinks rely on foreign key attributes in domain classes.

cheers,
Thomas

Thanks for any clarification...

/rick.



--
To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>






--
To unsubscribe, e-mail:   <mailto:ojb-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>

Reply via email to