jmcnally    01/10/15 19:51:21

  Modified:    src/java/org/apache/torque/util BasePeer.java
  Log:
  only throw the exception in the event the keyGenerator should not be null.
  
  Revision  Changes    Path
  1.14      +7 -7      
jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java
  
  Index: BasePeer.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/util/BasePeer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- BasePeer.java     2001/10/15 05:56:02     1.13
  +++ BasePeer.java     2001/10/16 02:51:21     1.14
  @@ -110,7 +110,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Frank Y. Kim</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>John D. McNally</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Brett McLaughlin</a>
  - * @version $Id: BasePeer.java,v 1.13 2001/10/15 05:56:02 jon Exp $
  + * @version $Id: BasePeer.java,v 1.14 2001/10/16 02:51:21 jmcnally Exp $
    */
   public abstract class BasePeer implements java.io.Serializable
   {
  @@ -760,17 +760,12 @@
               throw new Exception("Database insert attempted without " + 
                   "anything specified to insert");
           }
  +        
           DatabaseMap dbMap = Torque.getDatabaseMap( criteria.getDbName() );
           TableMap tableMap = dbMap.getTable(tableName);
           Object keyInfo = tableMap.getPrimaryKeyMethodInfo();
           IdGenerator keyGen = tableMap.getIdGenerator();
   
  -        if (keyGen == null)
  -        {
  -            throw new Exception ("IdGenerator for: '" + tableName + 
  -                "' is null.");
  -        }
  -
           ColumnMap pk = getPrimaryKey(criteria);
           // only get a new key value if you need to
           // the reason is that a primary key might be defined
  @@ -781,6 +776,11 @@
   
           if (!criteria.containsKey(pk.getFullyQualifiedName()))
           {
  +            if (keyGen == null)
  +            {
  +                throw new Exception ("IdGenerator for: '" + tableName + 
  +                                     "' is null.");
  +            }
               // If the keyMethod is SEQUENCE or IDBROKERTABLE, get the id
               // before the insert.
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to