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]>

Reply via email to