Hi,

Iris Soto wrote:
Hello all,
I've problems to handle 1:1 relationships, I want this association is navigable on both sides, from person to passport and vice versa. I'm working with OJB and Postgresql, how can i declare in the ojb descriptor, in the schema this type of relationships, i try this way, but i get the following error: proxy.IndirectionHandler - Can not materialize object for Identity org.apache.ojb.Person{25} - using PBKey org.apache.ojb.broker.PBKey: jcdAlias=default, user=postgres, password=*****

Which version of OJB do you use?
Did you enable CGLib proxy support in OJB.properties file?
Did your test pass without using proxied references?

In your mapping you don't use separate FK for the 1:1 references. This could cause unexpected behavior when using proxy references. Assume you are nullify the Passport of a Person. Next time you materialize the Person object OJB tries to resolve the reference to Passport by lookup the FK defined in Person. You define the Person PK as FK for Passport reference (the FK to Passport could never be nullified), thus OJB assume that the reference to Passport still exists and create a proxy reference (instead of setting null). If you now try to access the Passport reference in Person you will get a NPE, because OJB can't find the Passport object.

regards,
Armin


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to