Still no luck with a clean database. There are three tables involved in the mapping and there are no special constraints unless you consider the primary keys which are listed as follows:
lead table lead_id notification table notification_id notification_lead table lead_id notification_id -----Original Message----- From: Mauricio CASTRO [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 10, 2003 4:53 PM To: OJB Users List Subject: Re: Non-decomposed m:n mappings with ODMG May be you have DB constraints set like a PK. May be you have a unique restriction in the lead table and you already inserted a record with fn=eric and ln=Northam. Try to change the data and run it again or delete all the tables. "Until they become conscious they will never rebel, and until after they have rebelled they cannot become conscious" --Orwell 1984 ----- Original Message ----- From: "Eric Northam" <[EMAIL PROTECTED]> To: "'OJB Users List'" <[EMAIL PROTECTED]> Sent: Tuesday, June 10, 2003 3:41 PM Subject: RE: Non-decomposed m:n mappings with ODMG > Sure thing, > > The following causes a BatchUpdateException: > > Invalid argument value, message from server: "Duplicate entry '41' > for key > 1" > java.sql.BatchUpdateException: Invalid argument value, message from server: > "Duplicate entry '41' for key 1 > > at > com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1367) > at > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.doExecut > e(Unknown Source) > at > org.apache.ojb.broker.util.batch.PreparedStatementInvocationHandler.invoke(U > nknown Source) > at $Proxy0.doExecute(Unknown Source) > at org.apache.ojb.broker.util.batch.BatchConnection.executeBatch(Unknown > Source) > > .... > > --- Store code ---- > > Implementation odmg = OJB.getInstance(); > Database db = odmg.newDatabase(); > > Lead leadBO = new Lead(); > leadBO.setFirstName("Eric"); > leadBO.setLastName("Northam"); > leadBO.setEmail("[EMAIL PROTECTED]"); > > Notification notification = new Notification(); > notification.setName("Test notification"); > > ArrayList notifications = new ArrayList(); > notifications.add(notification); > leadBO.setNotifications(notifications); > > db.open(null, Database.OPEN_READ_WRITE); > > Transaction tx = odmg.newTransaction(); > > tx.begin(); > tx.lock(leadBO, Transaction.WRITE); > tx.commit(); > > --- > > --- repository_user.xml --- > > <class-descriptor class="xxx.bo.Lead" table="lead"> <field-descriptor > name="id" column="lead_id" jdbc-type="INTEGER" primarykey="true" > autoincrement="true"/> <field-descriptor name="firstName" > column="first_name" jdbc-type="VARCHAR"/> > <field-descriptor name="lastName" column="last_name" > jdbc-type="VARCHAR"/> > <field-descriptor name="email" column="email" > jdbc-type="VARCHAR"/> > <collection-descriptor name="notifications" > element-class-ref="xxx.bo.Notification" auto-retrieve="true" > auto-update="true" indirection-table="notification_lead"> > <fk-pointing-to-this-class column="lead_id"/> > <fk-pointing-to-element-class > column="notification_id"/> > </collection-descriptor> > </class-descriptor> > > <class-descriptor class="xxx.bo.Notification" table="notification"> > <field-descriptor name="id" column="notification_id" > jdbc-type="INTEGER" primarykey="true" autoincrement="true"/> > <field-descriptor name="name" column="name" jdbc-type="VARCHAR"/> > <field-descriptor name="type" column="type" > jdbc-type="VARCHAR"/> > <collection-descriptor name="leads" > element-class-ref="xxx.bo.Lead" auto-retrieve="true" auto-update="true" > indirection-table="notification_lead" > > <fk-pointing-to-this-class > column="notification_id"/> > <fk-pointing-to-element-class column="lead_id"/> > </collection-descriptor> > </class-descriptor> > > ------- > > > TIA, > > Eric > > -----Original Message----- > From: Mauricio CASTRO [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 10, 2003 4:12 PM > To: OJB Users List > Subject: Re: Non-decomposed m:n mappings with ODMG > > > Eric, > > No, I use Postgesql. Try to post your repository_user.xml, and the > source code that is supposed to do the work. > > > Mauricio Castro. > > "Until they become conscious they will never rebel, and until after > they have rebelled they cannot become conscious" --Orwell 1984 > ----- Original Message ----- > From: "Eric Northam" <[EMAIL PROTECTED]> > To: "'OJB Users List'" <[EMAIL PROTECTED]> > Sent: Tuesday, June 10, 2003 3:12 PM > Subject: RE: Non-decomposed m:n mappings with ODMG > > > > You wouldn't happen to be using MySQL? > > > > -----Original Message----- > > From: Mauricio CASTRO [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, June 10, 2003 4:06 PM > > To: OJB Users List > > Subject: Re: Non-decomposed m:n mappings with ODMG > > > > > > > > I succesfuly use an m:n mapping and ODMG. > > > > "Until they become conscious they will never rebel, and until after > > they have rebelled they cannot become conscious" --Orwell 1984 > > ----- Original Message ----- > > From: "Eric Northam" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, June 10, 2003 3:07 PM > > Subject: Non-decomposed m:n mappings with ODMG > > > > > > > Has anyone been able to store an object with an m:n mapping using > > > the ODMG api? It works fine with the persistence broker but > > > doesn't work with ODMG > > as > > > far as I can tell. Unfortunately I have several objects with a > > > many to > > many > > > relationship so I'm wondering whether I should drop using the ODMG > > > api all together. Is there any consequence to using both ODMG and > > > the persistence broker together as a workaround? > > > > > > Eric > > > > > > > > > > > > > > > > > > DISCLAIMER: The information contained in this e-mail is, unless > > > otherwise indicated, confidential and is intended solely for the > > > use of the named addressee. Access, copying or re-use of the > > > e-mail or any information contained therein by any other person is > > > not authorized. If you are not > > the > > > intended recipient please notify us immediately by returning the > > > e-mail to the originator. > > > > > > > -------------------------------------------------------------------- > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > DISCLAIMER: The information contained in this e-mail is, unless > > otherwise indicated, confidential and is intended solely for the use > > of the named addressee. Access, copying or re-use of the e-mail or > > any information contained therein by any other person is not > > authorized. If you are not > the > > intended recipient please notify us immediately by returning the > > e-mail to the originator. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > DISCLAIMER: The information contained in this e-mail is, unless > otherwise indicated, confidential and is intended solely for the use > of the named addressee. Access, copying or re-use of the e-mail or any > information contained therein by any other person is not authorized. > If you are not the > intended recipient please notify us immediately by returning the > e-mail to the originator. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: The information contained in this e-mail is, unless otherwise indicated, confidential and is intended solely for the use of the named addressee. Access, copying or re-use of the e-mail or any information contained therein by any other person is not authorized. If you are not the intended recipient please notify us immediately by returning the e-mail to the originator.
