hi scott,

check BrokerHelper#getKeyValues()

jakob

Weaver, Scott wrote:

Yup, that was it. FieldConversions break backreferences. Verfied in both ODMG and PB. Any idea how I can fix that or were I can look.

*===================================*
* Scott T Weaver *
* Jakarta Jetspeed Portal Project *
* [EMAIL PROTECTED] *
*===================================*





-----Original Message-----
From: Mahler Thomas [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 12:28 PM
To: 'OJB Users List'
Subject: RE: 1:n mapping

Hi again,

FieldConversions could be a factor.
We have testcases for FieldConversions on PrimaryKey fields, but I think
no
tests for 1:n plus backreference + FieldConversion on foreignkey.

Can you modify your setup to test without fieldconversion?

cheers,
thomas




-----Original Message-----
From: Weaver, Scott [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 6:29 PM
To: 'OJB Users List'
Subject: RE: 1:n mapping


Hi Thomas,


The test case runs fine, but my implementation is still
failing using both ODMG and PB with auto-update/auto-retrieve
set to true.  I am using field conversions in my PK and FK
fields.  Could that be a factor?

*===================================*
* Scott T Weaver                    *
* Jakarta Jetspeed Portal Project   *
* [EMAIL PROTECTED]                 *
*===================================*





-----Original Message-----
From: Mahler Thomas [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 10:11 AM
To: 'OJB Users List'
Subject: RE: 1:n mapping

Hi all,

Mhh, strange.
There is a testcase o.a.ojb.broker.AutomaticForeignKeys


that explicitely


tests the assignement of foreign keys for such a 1:n association.

/** test automatic assignment of foreign keys for 1:n


reference. */


        public void testOneManyReference()
        {
                try
                {
                        Article art1 = new Article();
                        art1.setArticleName("TOPLink");
                        Article art2 = new Article();
                        art2.setArticleName("OJB");
                        Article art3 = new Article();
                        art3.setArticleName("CASTOR");
                        ProductGroup pg = new ProductGroup();
                        pg.setName("O/R mapping tools");
                        pg.add(art1);
                        pg.add(art2);
                        pg.add(art3);
                        Identity pgOID = new Identity(pg, broker);
                        broker.store(pg);
                        broker.clearCache();
                        InterfaceProductGroup readInPG =
                                (InterfaceProductGroup)
broker.getObjectByIdentity(pgOID);
                        assertEquals(pg.getName(), readInPG.getName());
                        assertEquals(pg.getAllArticles().size(),
readInPG.getAllArticles().size());
                        InterfaceArticle art1a = (InterfaceArticle)
pg.getAllArticles().get(0);
                        InterfaceArticle art2a = (InterfaceArticle)
pg.getAllArticles().get(1);
                        InterfaceArticle art3a = (InterfaceArticle)
pg.getAllArticles().get(2);
                        assertEquals(art1.getArticleName(),
art1a.getArticleName());
                        assertEquals(art2.getArticleName(),
art2a.getArticleName());
                        assertEquals(art3.getArticleName(),
art3a.getArticleName());
                }
                catch (Throwable t)
                {
                        System.out.println(t.getMessage());
                        t.printStackTrace();
                        fail(t.getMessage());
                }
        }

Article has a backreference to Productgroup.
this testcase passes, so I have no idea what could be wrong here...

cheers,
Thomas



-----Original Message-----
From: Weaver, Scott [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 4:08 PM
To: 'OJB Users List'
Subject: RE: 1:n mapping


I have been having the same issue with 1:n mappings were n's FK is not getting updated if "n" has a reference-descriptor back to "1".

*===================================*
* Scott T Weaver                    *
* Jakarta Jetspeed Portal Project   *
* [EMAIL PROTECTED]                 *
*===================================*





-----Original Message-----
From: Timofey Korolev [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 9:11 AM
To: OJB Users List
Subject: RE: 1:n mapping

On Mon, 2003-06-30 at 17:08, Mahler Thomas wrote:


>


When i'm saying in my application


broker.strore(General) OJB doesn't


makes any records in PARTICLE table.


Ahh! That's easy:


WoW!
That worked but partially ;-)
select * from PARTICLE looks like

id | name | gid
----+----------+-----
 3 | AAA      |
 4 | BBB      |

but the gid column is empty. And it has to reference


GENERAL table's


ID-field.

May be something is wrong with my reference-descriptor for


generalId?


--
Regards,
CEO Linux-Online.Ru
Korolyov Timofey

www.linuxshop.ru :: www.prefnews.ru :: www.dotstyle.ru

JabberID: [EMAIL PROTECTED]







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



Reply via email to