The name of the method is : broker.retrieveAllReferences()

Frank

-----Original Message-----
From: Graham Lounder [mailto:[EMAIL PROTECTED]
Sent: woensdag 3 december 2003 15:13
To: 'OJB Users List'
Subject: RE: Upgrade form 0.9.5 to 1.0rc4 : foreign key problem


Hey Wally,

So if I call broker.resolveAllReferences(obj); in my generic store method, I
should be able to remove my hack that stops OJB from setting my foreign keys
to null?  I guess this may slow things down a little but I prefer to get rid
of my custom OJB code.

Graham

-----Original Message-----
From: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED]
Sent: December 3, 2003 10:07 AM
To: OJB Users List
Subject: RE: Upgrade form 0.9.5 to 1.0rc4 : foreign key problem


Hi Frank,

I upgraded from ojb0.9.5 to 1.0 rc4.
Some of my unit tests fail because sometimes foreign key values (1 - N
relationship) are not stored :

Example : 
-------------------------
            // Create productgroup
            ProductGroup pg = new ProductGroupBean();
            pg.setGroupName("TESTPRODUCTGROUP");
            pg.setGroupDescription("DESCRIPTION");
            broker.store(pg);

            // Create 2 articles for this productgroup
            for (int j = 1; j <= 2; j++) {
                Article ar = new ArticleBean();
                ar.setArticleName("ARTICLE " + j);
                ar.setProductGroupId(pg.getGroupId());  -------> NOT
stored in the database
                broker.store(ar);
            }

Is this a bug ?

No, this isn't a bug.  You have to either set the reference (i.e.
ar.setProductGroup(pg)) or set the ID and resolve the reference (i.e.
ar.setProductGroupId(pg.getGroupId()); broker.resolveAllReferences(ar);
broker.store(ar); )

Hope this helps,

Wally Gelhar
UW - Eau Claire
Facilities Planning & Management


---------------------------------------------------------------------
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]

Reply via email to