Good catch. I just rewrote the relationship loading/setting code, so I'll have to hunt this down in my new code.
thanks -dain > -----Original Message----- > From: Dave Smith [mailto:[EMAIL PROTECTED]] > Sent: Monday, January 14, 2002 8:05 AM > To: [EMAIL PROTECTED] > Subject: [JBoss-dev] Bug in relations > > > I was testing the current state of the relation code and I believe I > have stumbled across a bug. > > If the primary key class of relationship is different then it > bombs. So > if you have table_a and table_b in a 1-1 uni-directional relationship > with table_a primary key class of TableAPk and table_b > primary key class > TableBPk it bombs. > > It looks like the problem is in JDBCCMRFieldBridge.java > around line 780. > When it is creating and setting the primary key of the CMRField. > > fk = foreignKeyFields[i].setPrimaryKeyValue(fk, fieldValue); > > The problem is that if fk is null it creates a Pk class but in > foreignKeyFields the entity is current class not the related one. > So for TableA CMR field is is creating a class of TableAPk > not TableBPk. > > I added the this before the call and it seems to work > > if(fk == null) > fk=relatedManager.getEntityBridge().createPrimaryKeyInstance(); > > > > > _______________________________________________ > Jboss-development mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-development > _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
