It does not look like you are using IDBroker to get keys. You are setting them based on relationships to other tables. I think you will have more luck with idMethod="none", if you are manually setting the id(s).
john mcnally Tom Keeney wrote: > > John, > > No, idMethod="idbroker". > > Here's the schema for the table in question: > > <table name="NOVUS_PRODUCT_DOCUMENT" idMethod="idbroker" > javaName="ProductDocument" skipSql="false" abstract="false"> > <column name="PRODUCT_ID" required="true" primaryKey="true" > type="INTEGER" autoIncrement="false" inheritance="false" /> > <column name="DOCUMENT_ID" required="true" primaryKey="true" > type="INTEGER" autoIncrement="false" inheritance="false" /> > - <foreign-key foreignTable="NOVUS_PRODUCT" onUpdate="none" > onDelete="none"> > <reference local="PRODUCT_ID" foreign="PRODUCT_ID" /> > </foreign-key> > - <foreign-key foreignTable="NOVUS_DOCUMENT" onUpdate="none" > onDelete="none"> > <reference local="DOCUMENT_ID" foreign="DOCUMENT_ID" /> > </foreign-key> > </table> > > -----Original Message----- > From: John McNally [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 14, 2001 3:15 PM > To: Turbine Users List > Subject: Re: Peer.doInsert() throwing "DB Insert attempted w/o anything > specified to insert" Exception > > have you set idMethod="none" for this table in the xml schema? > > john mcnally > > Tom Keeney wrote: > > > > Hello all, > > > > My Peer object is throwing the exception specified in the Subject line > > when I run the following code: > > > > ProductDocument prodDoc = new ProductDocument(); > > > > try > > { > > prodDoc.setDocumentId("2000"); > > prodDoc.setProductId("3000"); > > > > System.out.println("prodDoc: " + > > prodDoc.toString()); > > System.out.println("documentid: " + > > prodDoc.getDocumentId().toString()); > > System.out.println("productid: " + > > prodDoc.getProductId().toString()); > > > > ProductDocumentPeer.doInsert(prodDoc); > > } > > catch (Exception ex).... > > > > I'm attempting an insert against a many-to-many table named > > Novus_Product_Document that has two primary keys, DocumentId and > > ProductId. > > > > I've traced the exception back to the doInsert() method in the > BasePeer > > class (see below). Apparently BasePeer thinks I have no table > specified. > > I am confused since I have used Peer.doInsert() successfully for a > > different table. Is the problem because I'm trying to insert a > primary > > key value into the Novus_Product_Document table? Any ideas are much > > appreciated. > > > > public static ObjectKey doInsert(Criteria criteria, > > DBConnection dbCon) > > throws Exception > > { > > SimpleKey id = null; > > > > // Get the table name and method for determining the primary > > // key value. > > String tableName = null; > > Enumeration keys = criteria.keys(); > > if (keys.hasMoreElements()) > > { > > tableName = > > criteria.getTableName((String)keys.nextElement()); > > } > > else > > { > > throw new Exception("Database insert attempted without > > anything specified to insert"); > > } > > > > Thanks, > > > > Tom Keeney > > Novus Consulting Group > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
