You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by John McNally <jm...@collab.net> on 2001/11/14 21:14:56 UTC

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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>