works great. Thanks very much :-)
As you could see from my mail I started moving from primitives to objects. Your performance argument for 1:n is a very strong one. The null value problem was a side effect of my work.
best regards,
Guido
Armin Waibel wrote:
Hi Guido,
Guido Beutler wrote:
Hello,
I set the auto-retrieve attribute at repository to false for a 1:1 relationship.
I need the reference for a query but in most cases I do not want to read the referenced object.
After reading a instance I tried to store the same unmodified object again.
I run into a SQL error during the update statement "can not write null into not null field".
After some debugging I realized that the missing field is the FK field of not materialized 1:1 reference object.
We do a refactoring of the auto-xxx settings to prevent this problem. In your case set auto-update="none" instead of "false". Please see
http://db.apache.org/ojb/tutorial3.html#1:1%20auto-xxx%20setting
If you want to use auto-update="object" or "true", then you have to load the reference first, see
http://db.apache.org/ojb/tutorial3.html#auto-retrieve%20setting
Does this solve you problem?
By the way, in rc6 is bug when set auto-delete="false", OJB interpret it as "true", so better use "none". It's fixed in CVS.
regards, Armin
If I remove the reference descriptor from the mapping everything works fine, but my queries won't work.
For me it looks like storing an object when auto-retrieve is set to false fails.
I expected that ojb recognize that the auto-retrieve attribute was set to false and then takes
the fk attribute field for the update and not the reference which may be null (because not retrieved).
The fk field is of type Integer. The integer Object is filled with the correct value.
Any idea?
best regards,
Guido
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
