On Nov 28, 2003, at 9:31 AM, Tore Halset wrote:
> Person<<-->Gender
> My model is working, but after inserting a person with a gender it
> looks
> like a huge select are performed. Perhaps cayenne has to do a
> select * from person where genderid=1
> If the inserted person also has a genderid=1? Is it to update the
> relation
> from gender to person? How can I prevent it from happening.
You've worked with WebObjects if I am not mistaken? So this analogy
might explain some things. A huge select is due to the to-many
relationship from Gender to Person. When setting person's gender
Cayenne performs an analog of EOF's
"addObjectToBothSidesOfRelationshipWithKey", that results in faulting
the relationship both ways...
> Should I define the relation both ways in cayenne? Whould my
> application
> be faster in any way if i drop the obj-relation from gender to person?
> What about the db-relationship?
So answering your question, you must have a DB relationship defined
both ways, but you should define ObjRelationship only from person to
Gender, and remove the reverse to-many. There is a few tips in the docs
(somewhat scrambled). See items 2 and 3 here:
http://objectstyle.org/cayenne/modelerguide/modeling-tips.html
Andrus
This archive was generated by hypermail 2.0.0 : Sun Nov 30 2003 - 01:47:48 EST