hi Anders, Thanks for your reply. yes, I've also tried top swap the two foreignkey descriptor. However in this case it gives me this exception :
[DEFAULT] ERROR: bindSelect failed for: com.csi.jdo.bench.business.Article{15.0}, PK: 0, value: 15.0 [org.apache.ojb.broker.accesslayer.JdbcAccess] ERROR: SQLException during the execution of materializeObject (for a com.csi.jdo.bench.business.Produit): Cannot convert class java.lang.Double to SQL type requested Cannot convert class java.lang.Double to SQL type requested java.sql.SQLException: Cannot convert class java.lang.Double to SQL type requested at com.mysql.jdbc.PreparedStatement.setObject(Unknown Source) at com.mysql.jdbc.PreparedStatement.setObject(Unknown Source) at org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(Un known Source) at org.apache.ojb.broker.accesslayer.StatementManager.bindSelect(Unknown Source) at org.apache.ojb.broker.accesslayer.JdbcAccess.materializeObject(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getDBObject(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getExtentDBObject(Unkno wn Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getDBObject(Unknown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getObjectByIdentity(Unk nown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getReferencedObject(Unk nown Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReference(Unkno wn Source) at org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReferences(Unkn own Source) at org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unknown Source) at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source) where Produit is a subclass of Article and is mapped to its own table with a join to ARTICLE table (inheritance with joined table using a 1:1 association). However from what i understood i don't have to swap the reference descriptor, have i ? below are the debug informations : QCRIT: Query from class com.csi.jdo.bench.business.Remise where null [org.apache.ojb.broker.accesslayer.JdbcAccess] DEBUG: executeQuery : Query from class com.csi.jdo.bench.business.Remise where null [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: SELECT A0.MONTANT_MIN,A0.ID_REMISE,A0.POURCENTAGE,A0.REF_ARTICLE FROM REMISE A0 [org.apache.ojb.broker.ta.PersistenceBrokerFactoryDefaultImpl] INFO: Already created persistence broker instances: 1 [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: SELECT TARIF,REF_REMISE,ID_ARTICLE,REF_CATEGORIE,CLASS_INDICATOR,NOM FROM ARTICLE WHERE ID_ARTICLE = ? [org.apache.ojb.broker.singlevm.PersistenceBrokerImpl] DEBUG: subclass: com.csi.jdo.bench.business.Produit [org.apache.ojb.broker.accesslayer.sql.SqlGeneratorDefaultImpl] DEBUG: SQL: SELECT ID_ARTICLE,SN FROM PRODUIT WHERE Thanks for your help. -- gd ----- Original Message ----- From: "Anders Søe" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Thursday, November 14, 2002 10:11 PM Subject: SV: 1-1 Association throws ArrayIndexOutOfBoundsException > Have you tried swapping the two "foreignkey field-id-ref"s ? > > -----Oprindelig meddelelse----- > Fra: Gilles Dodinet [mailto:g.dodinet@;cross-systems.com] > Sendt: 14. november 2002 17:32 > Til: [EMAIL PROTECTED] > Emne: 1-1 Association throws ArrayIndexOutOfBoundsException > > > hi, > > I'm new to ojb and encounter some difficulties with 1-1 associations > mapping. I've searched through the list but haven't found an answer. > Though i think the two threads linked at the bottom of the message are > related to my problem but have no reply. > > I have a bidirectional 1-1 association between classes Article and > Remise and my mapping looks like : > > <class-descriptor class="com.csi.jdo.bench.business.Article" > table="ARTICLE"> > ... (some fields) > <field-descriptor id="4" name="ojbRemiseId" column="REF_REMISE" > jdbc-type="INTEGER"/> > <reference-descriptor name="remise" > class-ref="com.csi.jdo.bench.business.Remise"> > <foreignkey field-id-ref="4"/> > </reference-descriptor> > </class-descriptor> > > <class-descriptor class="com.csi.jdo.bench.business.Remise" > table="REMISE"> > ... (some fields) > <field-descriptor id="8" name="ojbArticleId" column="REF_ARTICLE" > jdbc-type="INTEGER"/> > <reference-descriptor name="article" > class-ref="com.csi.jdo.bench.business.Article"> > <foreignkey field-id-ref="8"/> > </reference-descriptor> > </class-descriptor> > > When i try to query the Remises i got the exception below : > > [org.apache.ojb.broker.accesslayer.RsIterator] ERROR: null > java.lang.ArrayIndexOutOfBoundsException > at > org.apache.ojb.broker.metadata.ClassDescriptor.getFieldDescriptorByIndex > (Unk > nown Source) > at > org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyFi > eldD > escriptors(Unknown Source) > at > org.apache.ojb.broker.metadata.ObjectReferenceDescriptor.getForeignKeyVa > lues > (Unknown Source) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getReferencedObject > (Unk > nown Source) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReference(U > nkno > wn Source) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.retrieveReferences( > Unkn > own Source) > at > org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(Unkn > own > Source) > at org.apache.ojb.broker.accesslayer.RsIterator.next(Unknown Source) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer > y(Un > known Source) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer > y(Un > known Source) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer > y(Un > known Source) > at > org.apache.ojb.broker.singlevm.PersistenceBrokerImpl.getCollectionByQuer > y(Un > known Source) > at org.apache.ojb.jdo.JDOQuery.execute(Unknown Source) > > I suspect this exception comes from a java.util.NoSuchElementException > thrown by RSIterator.next() qince the StackTrace printed to the console > and the junit one are not the same. > > When i comment the reference-descriptor in the Remise descriptor, this > problem disappears ; then the referenced Article is always null, but at > least ojb doesnt complain. I guess i'm doing something wrong but cannot > see what. Any help would be welcome. > > I've tried both the OJB JDO API (the one i'm planning to use) and the > PersistenceBroker API. In both case i got that exception. > > > Thanks for your help. > > regards, > > -- gd > > related threads ? > http://archives.apache.org/eyebrowse/ReadMsg?listName=ojb-user@;jakarta.a > pach > e.org&msgId=389869 > http://archives.apache.org/eyebrowse/ReadMsg?listName=ojb-user@;jakarta.a > pach > e.org&msgId=507762 > > > > > > -- > To unsubscribe, e-mail: > <mailto:ojb-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: > <mailto:ojb-user-help@;jakarta.apache.org> > > > -- > To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org> > -- To unsubscribe, e-mail: <mailto:ojb-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:ojb-user-help@;jakarta.apache.org>