Richard Schuller wrote:
Thanks Gelhar,
While that works it results into an unnecessary database call. Is there a way to bypass this behaviour?
Latest version from CVS has some improvements on object insert, e.g. now it is allowed to insert a new object only with reference id set (and reference object null). But only for insert!
>>If I set the sourceId to new Long(1234) and >>source=null the INSERT statement generated blanks
Should work with latest from CVS.
regards, Armin
Richard
--- "Gelhar, Wallace Joseph" <[EMAIL PROTECTED]> wrote:
Hi Richard,
This is not a bug, but rather behavior by design.
OJB is an object level mapping layer. Therefore, OJB is using the value of the reference object you set (null!) and updating the FK (i.e. clearing the field). If you first set the FK and want to resolve the object, you may call pb.retrieveReference("referenceAttribute"); to load the object before storing.
Hope this helps.
Wally
-----Original Message-----
From: Richard Schuller [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 1:20 PM
To: [EMAIL PROTECTED]
Subject: This looks like a bug in store()
I have a class A representing table TA defined as follows:
class A { .... private Long sourceId; private Long targetId; ... TCorporation source; TCorporation target; }
If I set the sourceId to new Long(1234) and source=null the INSERT statement generated blanks out the source id.
Anybody else ran into this?
Richard
__________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
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]
__________________________________ Do you Yahoo!? Yahoo! Finance: Get your refund fast by filing online. http://taxes.yahoo.com/filing.html
--------------------------------------------------------------------- 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]
