Re: Key in object not propulated from Foreign key listed in reference-descriptor

"Thomas Dudziak" <[email protected]>
Newsgroups gmane.comp.jakarta.ojb.user
Message-ID <[email protected]>
On 8/11/06, Wright, Jim (NIH/CIT) [C] <[email protected]> wrote:

> Tom, I also did a little experiment to see the order in which each
> object is inserted by the store method.  However the only one that
> appeared to be inserted was my report object which is the parent of
> scientist and IOS objects.  I was hoping I could at least try putting
> the current scid value into the scid field of IOS.  However IOS inserted
> but I had no relative idea when it was inserted due to the inability to
> get the "firing sequence" of the inserts.  I don't like to work around
> the whole idea of ORM but since I cannot change our database I was
> hoping for a workaround.

Mhmm, references and collections are only inserted if the auto-update
property in the corresponding descriptor is set to 'object' (or 'true'
which is the older name).
If you want to see what is happening, configure P6Spy (there's a FAQ
entry for that) and check the SQL that OJB generates.

But in general, it is not such a good idea to use PK fields for FK
fields. As I said, the identity of the object will change if you
change its reference to point to another object. And ORM tools like
OJB depend on the identity. This is what defines the object: different
PKs = different objects.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.