View Javadoc

    1   package org.apache.turbine.services.security.torque.om;
    2
    3   import java.math.BigDecimal;
    4   import java.sql.Connection;
    5   import java.sql.SQLException;
    6   import java.util.ArrayList;
    7   import java.util.Date;
    8   import java.util.Iterator;
    9   import java.util.LinkedList;
    10  import java.util.List;
    11
    12  import org.apache.torque.NoRowsException;
    13  import org.apache.torque.TooManyRowsException;
    14  import org.apache.torque.Torque;
    15  import org.apache.torque.TorqueException;
    16  import org.apache.torque.TorqueRuntimeException;
    17  import org.apache.torque.map.MapBuilder;
    18  import org.apache.torque.map.TableMap;
    19  import org.apache.torque.om.DateKey;
    20  import org.apache.torque.om.NumberKey;
    21  import org.apache.torque.om.StringKey;
    22  import org.apache.torque.om.ObjectKey;
    23  import org.apache.torque.om.SimpleKey;
    24  import org.apache.torque.util.BasePeer;
    25  import org.apache.torque.util.Criteria;
    26
    27  import com.workingdogs.village.DataSetException;
    28  import com.workingdogs.village.QueryDataSet;
    29  import com.workingdogs.village.Record;
    30
    31  // Local classes
    32  import org.apache.turbine.services.security.torque.om.map.*;
    33
    34
    35
    36
    37  /**
    38   * This class was autogenerated by Torque on:
    39   *
    40   * [Thu Jun 23 17:25:46 CEST 2011]
    41   *
    42   */
    43  public abstract class BaseTurbineUserGroupRolePeer
    44      extends BasePeer
    45  {
    46      /** Serial version */
    47      private static final long serialVersionUID = 1308842746584L;
    48
    49
    50      /** the default database name for this class */
    51      public static final String DATABASE_NAME;
    52
    53       /** the table name for this class */
    54      public static final String TABLE_NAME;
    55
    56      /**
    57       * @return the map builder for this peer
    58       * @throws TorqueException Any exceptions caught during processing will be
    59       *         rethrown wrapped into a TorqueException.
    60       * @deprecated Torque.getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME) instead
    61       */
    62      public static MapBuilder getMapBuilder()
    63          throws TorqueException
    64      {
    65          return Torque.getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME);
    66      }
    67
    68      /** the column name for the USER_ID field */
    69      public static final String USER_ID;
    70      /** the column name for the GROUP_ID field */
    71      public static final String GROUP_ID;
    72      /** the column name for the ROLE_ID field */
    73      public static final String ROLE_ID;
    74
    75      static
    76      {
    77          DATABASE_NAME = "default";
    78          TABLE_NAME = "TURBINE_USER_GROUP_ROLE";
    79
    80          USER_ID = "TURBINE_USER_GROUP_ROLE.USER_ID";
    81          GROUP_ID = "TURBINE_USER_GROUP_ROLE.GROUP_ID";
    82          ROLE_ID = "TURBINE_USER_GROUP_ROLE.ROLE_ID";
    83          if (Torque.isInit())
    84          {
    85              try
    86              {
    87                  Torque.getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME);
    88              }
    89              catch (TorqueException e)
    90              {
    91                  log.error("Could not initialize Peer", e);
    92                  throw new TorqueRuntimeException(e);
    93              }
    94          }
    95          else
    96          {
    97              Torque.registerMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME);
    98          }
    99      }
    100
    101     /** number of columns for this peer */
    102     public static final int numColumns =  3;
    103
    104     /** A class that can be returned by this peer. */
    105     protected static final String CLASSNAME_DEFAULT =
    106         "org.apache.turbine.services.security.torque.om.TurbineUserGroupRole";
    107
    108     /** A class that can be returned by this peer. */
    109     protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
    110
    111     /**
    112      * Class object initialization method.
    113      *
    114      * @param className name of the class to initialize
    115      * @return the initialized class
    116      */
    117     private static Class initClass(String className)
    118     {
    119         Class c = null;
    120         try
    121         {
    122             c = Class.forName(className);
    123         }
    124         catch (Throwable t)
    125         {
    126             log.error("A FATAL ERROR has occurred which should not "
    127                 + "have happened under any circumstance.  Please notify "
    128                 + "the Torque developers <torque-dev@db.apache.org> "
    129                 + "and give as many details as possible (including the error "
    130                 + "stack trace).", t);
    131
    132             // Error objects should always be propagated.
    133             if (t instanceof Error)
    134             {
    135                 throw (Error) t.fillInStackTrace();
    136             }
    137         }
    138         return c;
    139     }
    140
    141     /**
    142      * Get the list of objects for a ResultSet.  Please not that your
    143      * resultset MUST return columns in the right order.  You can use
    144      * getFieldNames() in BaseObject to get the correct sequence.
    145      *
    146      * @param results the ResultSet
    147      * @return the list of objects
    148      * @throws TorqueException Any exceptions caught during processing will be
    149      *         rethrown wrapped into a TorqueException.
    150      */
    151     public static List<TurbineUserGroupRole> resultSet2Objects(java.sql.ResultSet results)
    152             throws TorqueException
    153     {
    154         try
    155         {
    156             QueryDataSet qds = null;
    157             List<Record> rows = null;
    158             try
    159             {
    160                 qds = new QueryDataSet(results);
    161                 rows = getSelectResults(qds);
    162             }
    163             finally
    164             {
    165                 if (qds != null)
    166                 {
    167                     qds.close();
    168                 }
    169             }
    170
    171             return populateObjects(rows);
    172         }
    173         catch (SQLException e)
    174         {
    175             throw new TorqueException(e);
    176         }
    177         catch (DataSetException e)
    178         {
    179             throw new TorqueException(e);
    180         }
    181     }
    182
    183
    184
    185     /**
    186      * Method to do inserts.
    187      *
    188      * @param criteria object used to create the INSERT statement.
    189      * @throws TorqueException Any exceptions caught during processing will be
    190      *         rethrown wrapped into a TorqueException.
    191      */
    192     public static ObjectKey doInsert(Criteria criteria)
    193         throws TorqueException
    194     {
    195         return BaseTurbineUserGroupRolePeer
    196             .doInsert(criteria, (Connection) null);
    197     }
    198
    199     /**
    200      * Method to do inserts.  This method is to be used during a transaction,
    201      * otherwise use the doInsert(Criteria) method.  It will take care of
    202      * the connection details internally.
    203      *
    204      * @param criteria object used to create the INSERT statement.
    205      * @param con the connection to use
    206      * @throws TorqueException Any exceptions caught during processing will be
    207      *         rethrown wrapped into a TorqueException.
    208      */
    209     public static ObjectKey doInsert(Criteria criteria, Connection con)
    210         throws TorqueException
    211     {
    212         correctBooleans(criteria);
    213
    214         setDbName(criteria);
    215
    216         if (con == null)
    217         {
    218             return BasePeer.doInsert(criteria);
    219         }
    220         else
    221         {
    222             return BasePeer.doInsert(criteria, con);
    223         }
    224     }
    225
    226     /**
    227      * Add all the columns needed to create a new object.
    228      *
    229      * @param criteria object containing the columns to add.
    230      * @throws TorqueException Any exceptions caught during processing will be
    231      *         rethrown wrapped into a TorqueException.
    232      */
    233     public static void addSelectColumns(Criteria criteria)
    234             throws TorqueException
    235     {
    236         criteria.addSelectColumn(USER_ID);
    237         criteria.addSelectColumn(GROUP_ID);
    238         criteria.addSelectColumn(ROLE_ID);
    239     }
    240
    241     /**
    242      * changes the boolean values in the criteria to the appropriate type,
    243      * whenever a booleanchar or booleanint column is involved.
    244      * This enables the user to create criteria using Boolean values
    245      * for booleanchar or booleanint columns
    246      * @param criteria the criteria in which the boolean values should be corrected
    247      * @throws TorqueException if the database map for the criteria cannot be
    248                obtained.
    249      */
    250     public static void correctBooleans(Criteria criteria) throws TorqueException
    251     {
    252         correctBooleans(criteria, getTableMap());
    253     }
    254
    255     /**
    256      * Create a new object of type cls from a resultset row starting
    257      * from a specified offset.  This is done so that you can select
    258      * other rows than just those needed for this object.  You may
    259      * for example want to create two objects from the same row.
    260      *
    261      * @throws TorqueException Any exceptions caught during processing will be
    262      *         rethrown wrapped into a TorqueException.
    263      */
    264     public static TurbineUserGroupRole row2Object(Record row,
    265                                              int offset,
    266                                              Class cls)
    267         throws TorqueException
    268     {
    269         try
    270         {
    271             TurbineUserGroupRole obj = (TurbineUserGroupRole) cls.newInstance();
    272             TurbineUserGroupRolePeer.populateObject(row, offset, obj);
    273                 obj.setModified(false);
    274             obj.setNew(false);
    275
    276             return obj;
    277         }
    278         catch (InstantiationException e)
    279         {
    280             throw new TorqueException(e);
    281         }
    282         catch (IllegalAccessException e)
    283         {
    284             throw new TorqueException(e);
    285         }
    286     }
    287
    288     /**
    289      * Populates an object from a resultset row starting
    290      * from a specified offset.  This is done so that you can select
    291      * other rows than just those needed for this object.  You may
    292      * for example want to create two objects from the same row.
    293      *
    294      * @throws TorqueException Any exceptions caught during processing will be
    295      *         rethrown wrapped into a TorqueException.
    296      */
    297     public static void populateObject(Record row,
    298                                       int offset,
    299                                       TurbineUserGroupRole obj)
    300         throws TorqueException
    301     {
    302         try
    303         {
    304             obj.setUserId(row.getValue(offset + 0).asInt());
    305             obj.setGroupId(row.getValue(offset + 1).asInt());
    306             obj.setRoleId(row.getValue(offset + 2).asInt());
    307         }
    308         catch (DataSetException e)
    309         {
    310             throw new TorqueException(e);
    311         }
    312     }
    313
    314     /**
    315      * Method to do selects.
    316      *
    317      * @param criteria object used to create the SELECT statement.
    318      * @return List of selected Objects
    319      * @throws TorqueException Any exceptions caught during processing will be
    320      *         rethrown wrapped into a TorqueException.
    321      */
    322     public static List<TurbineUserGroupRole> doSelect(Criteria criteria) throws TorqueException
    323     {
    324         return populateObjects(doSelectVillageRecords(criteria));
    325     }
    326
    327     /**
    328      * Method to do selects within a transaction.
    329      *
    330      * @param criteria object used to create the SELECT statement.
    331      * @param con the connection to use
    332      * @return List of selected Objects
    333      * @throws TorqueException Any exceptions caught during processing will be
    334      *         rethrown wrapped into a TorqueException.
    335      */
    336     public static List<TurbineUserGroupRole> doSelect(Criteria criteria, Connection con)
    337         throws TorqueException
    338     {
    339         return populateObjects(doSelectVillageRecords(criteria, con));
    340     }
    341
    342     /**
    343      * Grabs the raw Village records to be formed into objects.
    344      * This method handles connections internally.  The Record objects
    345      * returned by this method should be considered readonly.  Do not
    346      * alter the data and call save(), your results may vary, but are
    347      * certainly likely to result in hard to track MT bugs.
    348      *
    349      * @throws TorqueException Any exceptions caught during processing will be
    350      *         rethrown wrapped into a TorqueException.
    351      */
    352     public static List<Record> doSelectVillageRecords(Criteria criteria)
    353         throws TorqueException
    354     {
    355         return BaseTurbineUserGroupRolePeer
    356             .doSelectVillageRecords(criteria, (Connection) null);
    357     }
    358
    359     /**
    360      * Grabs the raw Village records to be formed into objects.
    361      * This method should be used for transactions
    362      *
    363      * @param criteria object used to create the SELECT statement.
    364      * @param con the connection to use
    365      * @throws TorqueException Any exceptions caught during processing will be
    366      *         rethrown wrapped into a TorqueException.
    367      */
    368     public static List<Record> doSelectVillageRecords(Criteria criteria, Connection con)
    369         throws TorqueException
    370     {
    371         if (criteria.getSelectColumns().size() == 0)
    372         {
    373             addSelectColumns(criteria);
    374         }
    375         correctBooleans(criteria);
    376
    377         setDbName(criteria);
    378
    379         // BasePeer returns a List of Value (Village) arrays.  The array
    380         // order follows the order columns were placed in the Select clause.
    381         if (con == null)
    382         {
    383             return BasePeer.doSelect(criteria);
    384         }
    385         else
    386         {
    387             return BasePeer.doSelect(criteria, con);
    388         }
    389     }
    390
    391     /**
    392      * The returned List will contain objects of the default type or
    393      * objects that inherit from the default.
    394      *
    395      * @throws TorqueException Any exceptions caught during processing will be
    396      *         rethrown wrapped into a TorqueException.
    397      */
    398     public static List<TurbineUserGroupRole> populateObjects(List<Record> records)
    399         throws TorqueException
    400     {
    401         List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>(records.size());
    402
    403         // populate the object(s)
    404         for (int i = 0; i < records.size(); i++)
    405         {
    406             Record row =  records.get(i);
    407             results.add(TurbineUserGroupRolePeer.row2Object(row, 1,
    408                 TurbineUserGroupRolePeer.getOMClass()));
    409         }
    410         return results;
    411     }
    412
    413
    414     /**
    415      * The class that the Peer will make instances of.
    416      * If the BO is abstract then you must implement this method
    417      * in the BO.
    418      *
    419      * @throws TorqueException Any exceptions caught during processing will be
    420      *         rethrown wrapped into a TorqueException.
    421      */
    422     public static Class getOMClass()
    423         throws TorqueException
    424     {
    425         return CLASS_DEFAULT;
    426     }
    427
    428     /**
    429      * Method to do updates.
    430      *
    431      * @param criteria object containing data that is used to create the UPDATE
    432      *        statement.
    433      * @throws TorqueException Any exceptions caught during processing will be
    434      *         rethrown wrapped into a TorqueException.
    435      */
    436     public static void doUpdate(Criteria criteria) throws TorqueException
    437     {
    438          BaseTurbineUserGroupRolePeer
    439             .doUpdate(criteria, (Connection) null);
    440     }
    441
    442     /**
    443      * Method to do updates.  This method is to be used during a transaction,
    444      * otherwise use the doUpdate(Criteria) method.  It will take care of
    445      * the connection details internally.
    446      *
    447      * @param criteria object containing data that is used to create the UPDATE
    448      *        statement.
    449      * @param con the connection to use
    450      * @throws TorqueException Any exceptions caught during processing will be
    451      *         rethrown wrapped into a TorqueException.
    452      */
    453     public static void doUpdate(Criteria criteria, Connection con)
    454         throws TorqueException
    455     {
    456         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
    457         correctBooleans(criteria);
    458
    459
    460          selectCriteria.put(USER_ID, criteria.remove(USER_ID));
    461
    462          selectCriteria.put(GROUP_ID, criteria.remove(GROUP_ID));
    463
    464          selectCriteria.put(ROLE_ID, criteria.remove(ROLE_ID));
    465
    466         setDbName(criteria);
    467
    468         if (con == null)
    469         {
    470             BasePeer.doUpdate(selectCriteria, criteria);
    471         }
    472         else
    473         {
    474             BasePeer.doUpdate(selectCriteria, criteria, con);
    475         }
    476     }
    477
    478     /**
    479      * Method to do deletes.
    480      *
    481      * @param criteria object containing data that is used DELETE from database.
    482      * @throws TorqueException Any exceptions caught during processing will be
    483      *         rethrown wrapped into a TorqueException.
    484      */
    485      public static void doDelete(Criteria criteria) throws TorqueException
    486      {
    487          TurbineUserGroupRolePeer
    488             .doDelete(criteria, (Connection) null);
    489      }
    490
    491     /**
    492      * Method to do deletes.  This method is to be used during a transaction,
    493      * otherwise use the doDelete(Criteria) method.  It will take care of
    494      * the connection details internally.
    495      *
    496      * @param criteria object containing data that is used DELETE from database.
    497      * @param con the connection to use
    498      * @throws TorqueException Any exceptions caught during processing will be
    499      *         rethrown wrapped into a TorqueException.
    500      */
    501      public static void doDelete(Criteria criteria, Connection con)
    502         throws TorqueException
    503      {
    504         correctBooleans(criteria);
    505
    506         setDbName(criteria);
    507
    508         if (con == null)
    509         {
    510             BasePeer.doDelete(criteria, TABLE_NAME);
    511         }
    512         else
    513         {
    514             BasePeer.doDelete(criteria, TABLE_NAME, con);
    515         }
    516      }
    517
    518     /**
    519      * Method to do selects
    520      *
    521      * @throws TorqueException Any exceptions caught during processing will be
    522      *         rethrown wrapped into a TorqueException.
    523      */
    524     public static List<TurbineUserGroupRole> doSelect(TurbineUserGroupRole obj) throws TorqueException
    525     {
    526         return doSelect(buildSelectCriteria(obj));
    527     }
    528
    529     /**
    530      * Method to do inserts
    531      *
    532      * @throws TorqueException Any exceptions caught during processing will be
    533      *         rethrown wrapped into a TorqueException.
    534      */
    535     public static void doInsert(TurbineUserGroupRole obj) throws TorqueException
    536     {
    537         doInsert(buildCriteria(obj));
    538         obj.setNew(false);
    539         obj.setModified(false);
    540     }
    541
    542     /**
    543      * @param obj the data object to update in the database.
    544      * @throws TorqueException Any exceptions caught during processing will be
    545      *         rethrown wrapped into a TorqueException.
    546      */
    547     public static void doUpdate(TurbineUserGroupRole obj) throws TorqueException
    548     {
    549         doUpdate(buildCriteria(obj));
    550         obj.setModified(false);
    551     }
    552
    553     /**
    554      * @param obj the data object to delete in the database.
    555      * @throws TorqueException Any exceptions caught during processing will be
    556      *         rethrown wrapped into a TorqueException.
    557      */
    558     public static void doDelete(TurbineUserGroupRole obj) throws TorqueException
    559     {
    560         doDelete(buildSelectCriteria(obj));
    561     }
    562
    563     /**
    564      * Method to do inserts.  This method is to be used during a transaction,
    565      * otherwise use the doInsert(TurbineUserGroupRole) method.  It will take
    566      * care of the connection details internally.
    567      *
    568      * @param obj the data object to insert into the database.
    569      * @param con the connection to use
    570      * @throws TorqueException Any exceptions caught during processing will be
    571      *         rethrown wrapped into a TorqueException.
    572      */
    573     public static void doInsert(TurbineUserGroupRole obj, Connection con)
    574         throws TorqueException
    575     {
    576         doInsert(buildCriteria(obj), con);
    577         obj.setNew(false);
    578         obj.setModified(false);
    579     }
    580
    581     /**
    582      * Method to do update.  This method is to be used during a transaction,
    583      * otherwise use the doUpdate(TurbineUserGroupRole) method.  It will take
    584      * care of the connection details internally.
    585      *
    586      * @param obj the data object to update in the database.
    587      * @param con the connection to use
    588      * @throws TorqueException Any exceptions caught during processing will be
    589      *         rethrown wrapped into a TorqueException.
    590      */
    591     public static void doUpdate(TurbineUserGroupRole obj, Connection con)
    592         throws TorqueException
    593     {
    594         doUpdate(buildCriteria(obj), con);
    595         obj.setModified(false);
    596     }
    597
    598     /**
    599      * Method to delete.  This method is to be used during a transaction,
    600      * otherwise use the doDelete(TurbineUserGroupRole) method.  It will take
    601      * care of the connection details internally.
    602      *
    603      * @param obj the data object to delete in the database.
    604      * @param con the connection to use
    605      * @throws TorqueException Any exceptions caught during processing will be
    606      *         rethrown wrapped into a TorqueException.
    607      */
    608     public static void doDelete(TurbineUserGroupRole obj, Connection con)
    609         throws TorqueException
    610     {
    611         doDelete(buildSelectCriteria(obj), con);
    612     }
    613
    614     /**
    615      * Method to do deletes.
    616      *
    617      * @param pk ObjectKey that is used DELETE from database.
    618      * @throws TorqueException Any exceptions caught during processing will be
    619      *         rethrown wrapped into a TorqueException.
    620      */
    621     public static void doDelete(ObjectKey pk) throws TorqueException
    622     {
    623         BaseTurbineUserGroupRolePeer
    624            .doDelete(pk, (Connection) null);
    625     }
    626
    627     /**
    628      * Method to delete.  This method is to be used during a transaction,
    629      * otherwise use the doDelete(ObjectKey) method.  It will take
    630      * care of the connection details internally.
    631      *
    632      * @param pk the primary key for the object to delete in the database.
    633      * @param con the connection to use
    634      * @throws TorqueException Any exceptions caught during processing will be
    635      *         rethrown wrapped into a TorqueException.
    636      */
    637     public static void doDelete(ObjectKey pk, Connection con)
    638         throws TorqueException
    639     {
    640         doDelete(buildCriteria(pk), con);
    641     }
    642
    643     /** Build a Criteria object from an ObjectKey */
    644     public static Criteria buildCriteria( ObjectKey pk )
    645     {
    646         Criteria criteria = new Criteria();
    647         SimpleKey[] keys = (SimpleKey[])pk.getValue();
    648             criteria.add(USER_ID, keys[0]);
    649             criteria.add(GROUP_ID, keys[1]);
    650             criteria.add(ROLE_ID, keys[2]);
    651         return criteria;
    652      }
    653
    654     /** Build a Criteria object from the data object for this peer */
    655     public static Criteria buildCriteria( TurbineUserGroupRole obj )
    656     {
    657         Criteria criteria = new Criteria(DATABASE_NAME);
    658         criteria.add(USER_ID, obj.getUserId());
    659         criteria.add(GROUP_ID, obj.getGroupId());
    660         criteria.add(ROLE_ID, obj.getRoleId());
    661         return criteria;
    662     }
    663
    664     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
    665     public static Criteria buildSelectCriteria( TurbineUserGroupRole obj )
    666     {
    667         Criteria criteria = new Criteria(DATABASE_NAME);
    668             criteria.add(USER_ID, obj.getUserId());
    669             criteria.add(GROUP_ID, obj.getGroupId());
    670             criteria.add(ROLE_ID, obj.getRoleId());
    671         return criteria;
    672     }
    673
    674
    675
    676     /**
    677      * Retrieve a single object by pk
    678      *
    679      * @param pk the primary key
    680      * @throws TorqueException Any exceptions caught during processing will be
    681      *         rethrown wrapped into a TorqueException.
    682      * @throws NoRowsException Primary key was not found in database.
    683      * @throws TooManyRowsException Primary key was not found in database.
    684      */
    685     public static TurbineUserGroupRole retrieveByPK(ObjectKey pk)
    686         throws TorqueException, NoRowsException, TooManyRowsException
    687     {
    688         Connection db = null;
    689         TurbineUserGroupRole retVal = null;
    690         try
    691         {
    692             db = Torque.getConnection(DATABASE_NAME);
    693             retVal = retrieveByPK(pk, db);
    694         }
    695         finally
    696         {
    697             Torque.closeConnection(db);
    698         }
    699         return retVal;
    700     }
    701
    702     /**
    703      * Retrieve a single object by pk
    704      *
    705      * @param pk the primary key
    706      * @param con the connection to use
    707      * @throws TorqueException Any exceptions caught during processing will be
    708      *         rethrown wrapped into a TorqueException.
    709      * @throws NoRowsException Primary key was not found in database.
    710      * @throws TooManyRowsException Primary key was not found in database.
    711      */
    712     public static TurbineUserGroupRole retrieveByPK(ObjectKey pk, Connection con)
    713         throws TorqueException, NoRowsException, TooManyRowsException
    714     {
    715         Criteria criteria = buildCriteria(pk);
    716         List<TurbineUserGroupRole> v = doSelect(criteria, con);
    717         if (v.size() == 0)
    718         {
    719             throw new NoRowsException("Failed to select a row.");
    720         }
    721         else if (v.size() > 1)
    722         {
    723             throw new TooManyRowsException("Failed to select only one row.");
    724         }
    725         else
    726         {
    727             return (TurbineUserGroupRole)v.get(0);
    728         }
    729     }
    730
    731     /**
    732      * Retrieve a multiple objects by pk
    733      *
    734      * @param pks List of primary keys
    735      * @throws TorqueException Any exceptions caught during processing will be
    736      *         rethrown wrapped into a TorqueException.
    737      */
    738     public static List<TurbineUserGroupRole> retrieveByPKs(List<ObjectKey> pks)
    739         throws TorqueException
    740     {
    741         Connection db = null;
    742         List<TurbineUserGroupRole> retVal = null;
    743         try
    744         {
    745            db = Torque.getConnection(DATABASE_NAME);
    746            retVal = retrieveByPKs(pks, db);
    747         }
    748         finally
    749         {
    750             Torque.closeConnection(db);
    751         }
    752         return retVal;
    753     }
    754
    755     /**
    756      * Retrieve a multiple objects by pk
    757      *
    758      * @param pks List of primary keys
    759      * @param dbcon the connection to use
    760      * @throws TorqueException Any exceptions caught during processing will be
    761      *         rethrown wrapped into a TorqueException.
    762      */
    763     public static List<TurbineUserGroupRole> retrieveByPKs( List<ObjectKey> pks, Connection dbcon )
    764         throws TorqueException
    765     {
    766         List<TurbineUserGroupRole> objs = null;
    767         if (pks == null || pks.size() == 0)
    768         {
    769             objs = new LinkedList<TurbineUserGroupRole>();
    770         }
    771         else
    772         {
    773             Criteria criteria = new Criteria();
    774             Iterator<ObjectKey> iter = pks.iterator();
    775             while (iter.hasNext())
    776             {
    777                 ObjectKey pk =  iter.next();
    778                 SimpleKey[] keys = (SimpleKey[])pk.getValue();
    779                     Criteria.Criterion c0 = criteria.getNewCriterion(
    780                         USER_ID, keys[0], Criteria.EQUAL);
    781                     Criteria.Criterion c1 = criteria.getNewCriterion(
    782                         GROUP_ID, keys[1], Criteria.EQUAL);
    783                         c0.and(c1);
    784                     Criteria.Criterion c2 = criteria.getNewCriterion(
    785                         ROLE_ID, keys[2], Criteria.EQUAL);
    786                         c1.and(c2);
    787                 criteria.or(c0);
    788             }
    789         objs = doSelect(criteria, dbcon);
    790         }
    791         return objs;
    792     }
    793
    794
    795     /**
    796      * retrieve object using using pk values.
    797      *
    798      * @param userId int
    799      * @param groupId int
    800      * @param roleId int
    801      */
    802     public static TurbineUserGroupRole retrieveByPK(
    803  int userId
    804 , int groupId
    805 , int roleId
    806         ) throws TorqueException
    807     {
    808         Connection db = null;
    809         TurbineUserGroupRole retVal = null;
    810         try
    811         {
    812            db = Torque.getConnection(DATABASE_NAME);
    813            retVal = retrieveByPK(
    814  userId
    815 , groupId
    816 , roleId
    817                , db);
    818         }
    819         finally
    820         {
    821             Torque.closeConnection(db);
    822         }
    823         return retVal;
    824     }
    825
    826     /**
    827      * retrieve object using using pk values.
    828      *
    829      * @param userId int
    830      * @param groupId int
    831      * @param roleId int
    832      * @param con Connection
    833      */
    834     public static TurbineUserGroupRole retrieveByPK(
    835  int userId
    836 , int groupId
    837 , int roleId
    838        ,Connection con) throws TorqueException
    839     {
    840
    841         Criteria criteria = new Criteria(5);
    842         criteria.add(USER_ID, userId);
    843         criteria.add(GROUP_ID, groupId);
    844         criteria.add(ROLE_ID, roleId);
    845         List<TurbineUserGroupRole> v = doSelect(criteria, con);
    846         if (v.size() == 1)
    847         {
    848             return  v.get(0);
    849         }
    850         else
    851         {
    852             throw new TorqueException("Failed to select one and only one row.");
    853         }
    854     }
    855
    856
    857
    858
    859
    860
    861
    862
    863     /**
    864      * selects a collection of TurbineUserGroupRole objects pre-filled with their
    865      * TurbineUser objects.
    866      *
    867      * This method is protected by default in order to keep the public
    868      * api reasonable.  You can provide public methods for those you
    869      * actually need in TurbineUserGroupRolePeer.
    870      *
    871      * @throws TorqueException Any exceptions caught during processing will be
    872      *         rethrown wrapped into a TorqueException.
    873      */
    874     protected static List<TurbineUserGroupRole> doSelectJoinTurbineUser(Criteria criteria)
    875         throws TorqueException
    876     {
    877         return doSelectJoinTurbineUser(criteria, null);
    878     }
    879
    880     /**
    881      * selects a collection of TurbineUserGroupRole objects pre-filled with their
    882      * TurbineUser objects.
    883      *
    884      * This method is protected by default in order to keep the public
    885      * api reasonable.  You can provide public methods for those you
    886      * actually need in TurbineUserGroupRolePeer.
    887      *
    888      * @throws TorqueException Any exceptions caught during processing will be
    889      *         rethrown wrapped into a TorqueException.
    890      */
    891     protected static List<TurbineUserGroupRole> doSelectJoinTurbineUser(Criteria criteria, Connection conn)
    892         throws TorqueException
    893     {
    894         setDbName(criteria);
    895
    896         TurbineUserGroupRolePeer.addSelectColumns(criteria);
    897         int offset = numColumns + 1;
    898         TurbineUserPeer.addSelectColumns(criteria);
    899
    900         criteria.addJoin(TurbineUserGroupRolePeer.USER_ID,
    901             TurbineUserPeer.USER_ID);
    902
    903         correctBooleans(criteria);
    904
    905         List<Record> rows;
    906         if (conn == null)
    907         {
    908             rows = BasePeer.doSelect(criteria);
    909         }
    910         else
    911         {
    912             rows = BasePeer.doSelect(criteria,conn);
    913         }
    914
    915         List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
    916
    917         for (int i = 0; i < rows.size(); i++)
    918         {
    919             Record row =  rows.get(i);
    920
    921             Class omClass = TurbineUserGroupRolePeer.getOMClass();
    922             TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
    923                 .row2Object(row, 1, omClass);
    924              omClass = TurbineUserPeer.getOMClass();
    925             TurbineUser obj2 = (TurbineUser) TurbineUserPeer
    926                 .row2Object(row, offset, omClass);
    927
    928             boolean newObject = true;
    929             for (int j = 0; j < results.size(); j++)
    930             {
    931                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    932                 TurbineUser temp_obj2 = (TurbineUser) temp_obj1.getTurbineUser();
    933                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
    934                 {
    935                     newObject = false;
    936                     temp_obj2.addTurbineUserGroupRole(obj1);
    937                     break;
    938                 }
    939             }
    940             if (newObject)
    941             {
    942                 obj2.initTurbineUserGroupRoles();
    943                 obj2.addTurbineUserGroupRole(obj1);
    944             }
    945             results.add(obj1);
    946         }
    947         return results;
    948     }
    949
    950
    951
    952
    953     /**
    954      * selects a collection of TurbineUserGroupRole objects pre-filled with their
    955      * TurbineGroup objects.
    956      *
    957      * This method is protected by default in order to keep the public
    958      * api reasonable.  You can provide public methods for those you
    959      * actually need in TurbineUserGroupRolePeer.
    960      *
    961      * @throws TorqueException Any exceptions caught during processing will be
    962      *         rethrown wrapped into a TorqueException.
    963      */
    964     protected static List<TurbineUserGroupRole> doSelectJoinTurbineGroup(Criteria criteria)
    965         throws TorqueException
    966     {
    967         return doSelectJoinTurbineGroup(criteria, null);
    968     }
    969
    970     /**
    971      * selects a collection of TurbineUserGroupRole objects pre-filled with their
    972      * TurbineGroup objects.
    973      *
    974      * This method is protected by default in order to keep the public
    975      * api reasonable.  You can provide public methods for those you
    976      * actually need in TurbineUserGroupRolePeer.
    977      *
    978      * @throws TorqueException Any exceptions caught during processing will be
    979      *         rethrown wrapped into a TorqueException.
    980      */
    981     protected static List<TurbineUserGroupRole> doSelectJoinTurbineGroup(Criteria criteria, Connection conn)
    982         throws TorqueException
    983     {
    984         setDbName(criteria);
    985
    986         TurbineUserGroupRolePeer.addSelectColumns(criteria);
    987         int offset = numColumns + 1;
    988         TurbineGroupPeer.addSelectColumns(criteria);
    989
    990         criteria.addJoin(TurbineUserGroupRolePeer.GROUP_ID,
    991             TurbineGroupPeer.GROUP_ID);
    992
    993         correctBooleans(criteria);
    994
    995         List<Record> rows;
    996         if (conn == null)
    997         {
    998             rows = BasePeer.doSelect(criteria);
    999         }
    1000         else
    1001         {
    1002             rows = BasePeer.doSelect(criteria,conn);
    1003         }
    1004
    1005         List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
    1006
    1007         for (int i = 0; i < rows.size(); i++)
    1008         {
    1009             Record row =  rows.get(i);
    1010
    1011             Class omClass = TurbineUserGroupRolePeer.getOMClass();
    1012             TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
    1013                 .row2Object(row, 1, omClass);
    1014              omClass = TurbineGroupPeer.getOMClass();
    1015             TurbineGroup obj2 = (TurbineGroup) TurbineGroupPeer
    1016                 .row2Object(row, offset, omClass);
    1017
    1018             boolean newObject = true;
    1019             for (int j = 0; j < results.size(); j++)
    1020             {
    1021                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1022                 TurbineGroup temp_obj2 = (TurbineGroup) temp_obj1.getTurbineGroup();
    1023                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
    1024                 {
    1025                     newObject = false;
    1026                     temp_obj2.addTurbineUserGroupRole(obj1);
    1027                     break;
    1028                 }
    1029             }
    1030             if (newObject)
    1031             {
    1032                 obj2.initTurbineUserGroupRoles();
    1033                 obj2.addTurbineUserGroupRole(obj1);
    1034             }
    1035             results.add(obj1);
    1036         }
    1037         return results;
    1038     }
    1039
    1040
    1041
    1042
    1043     /**
    1044      * selects a collection of TurbineUserGroupRole objects pre-filled with their
    1045      * TurbineRole objects.
    1046      *
    1047      * This method is protected by default in order to keep the public
    1048      * api reasonable.  You can provide public methods for those you
    1049      * actually need in TurbineUserGroupRolePeer.
    1050      *
    1051      * @throws TorqueException Any exceptions caught during processing will be
    1052      *         rethrown wrapped into a TorqueException.
    1053      */
    1054     protected static List<TurbineUserGroupRole> doSelectJoinTurbineRole(Criteria criteria)
    1055         throws TorqueException
    1056     {
    1057         return doSelectJoinTurbineRole(criteria, null);
    1058     }
    1059
    1060     /**
    1061      * selects a collection of TurbineUserGroupRole objects pre-filled with their
    1062      * TurbineRole objects.
    1063      *
    1064      * This method is protected by default in order to keep the public
    1065      * api reasonable.  You can provide public methods for those you
    1066      * actually need in TurbineUserGroupRolePeer.
    1067      *
    1068      * @throws TorqueException Any exceptions caught during processing will be
    1069      *         rethrown wrapped into a TorqueException.
    1070      */
    1071     protected static List<TurbineUserGroupRole> doSelectJoinTurbineRole(Criteria criteria, Connection conn)
    1072         throws TorqueException
    1073     {
    1074         setDbName(criteria);
    1075
    1076         TurbineUserGroupRolePeer.addSelectColumns(criteria);
    1077         int offset = numColumns + 1;
    1078         TurbineRolePeer.addSelectColumns(criteria);
    1079
    1080         criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID,
    1081             TurbineRolePeer.ROLE_ID);
    1082
    1083         correctBooleans(criteria);
    1084
    1085         List<Record> rows;
    1086         if (conn == null)
    1087         {
    1088             rows = BasePeer.doSelect(criteria);
    1089         }
    1090         else
    1091         {
    1092             rows = BasePeer.doSelect(criteria,conn);
    1093         }
    1094
    1095         List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
    1096
    1097         for (int i = 0; i < rows.size(); i++)
    1098         {
    1099             Record row =  rows.get(i);
    1100
    1101             Class omClass = TurbineUserGroupRolePeer.getOMClass();
    1102             TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
    1103                 .row2Object(row, 1, omClass);
    1104              omClass = TurbineRolePeer.getOMClass();
    1105             TurbineRole obj2 = (TurbineRole) TurbineRolePeer
    1106                 .row2Object(row, offset, omClass);
    1107
    1108             boolean newObject = true;
    1109             for (int j = 0; j < results.size(); j++)
    1110             {
    1111                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1112                 TurbineRole temp_obj2 = (TurbineRole) temp_obj1.getTurbineRole();
    1113                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
    1114                 {
    1115                     newObject = false;
    1116                     temp_obj2.addTurbineUserGroupRole(obj1);
    1117                     break;
    1118                 }
    1119             }
    1120             if (newObject)
    1121             {
    1122                 obj2.initTurbineUserGroupRoles();
    1123                 obj2.addTurbineUserGroupRole(obj1);
    1124             }
    1125             results.add(obj1);
    1126         }
    1127         return results;
    1128     }
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136     /**
    1137      * selects a collection of TurbineUserGroupRole objects pre-filled with
    1138      * all related objects.
    1139      *
    1140      * This method is protected by default in order to keep the public
    1141      * api reasonable.  You can provide public methods for those you
    1142      * actually need in TurbineUserGroupRolePeer.
    1143      *
    1144      * @throws TorqueException Any exceptions caught during processing will be
    1145      *         rethrown wrapped into a TorqueException.
    1146      */
    1147     protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineUser(Criteria criteria)
    1148         throws TorqueException
    1149     {
    1150         return doSelectJoinAllExceptTurbineUser(criteria, null);
    1151     }
    1152
    1153     /**
    1154      * selects a collection of TurbineUserGroupRole objects pre-filled with
    1155      * all related objects.
    1156      *
    1157      * This method is protected by default in order to keep the public
    1158      * api reasonable.  You can provide public methods for those you
    1159      * actually need in TurbineUserGroupRolePeer.
    1160      *
    1161      * @throws TorqueException Any exceptions caught during processing will be
    1162      *         rethrown wrapped into a TorqueException.
    1163      */
    1164     protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineUser(Criteria criteria, Connection conn)
    1165         throws TorqueException
    1166     {
    1167         setDbName(criteria);
    1168
    1169         addSelectColumns(criteria);
    1170         int offset2 = numColumns + 1;
    1171
    1172
    1173         TurbineGroupPeer.addSelectColumns(criteria);
    1174         criteria.addJoin(TurbineUserGroupRolePeer.GROUP_ID, TurbineGroupPeer.GROUP_ID);
    1175         int offset3 = offset2 + TurbineGroupPeer.numColumns;
    1176
    1177         TurbineRolePeer.addSelectColumns(criteria);
    1178         criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID, TurbineRolePeer.ROLE_ID);
    1179
    1180         correctBooleans(criteria);
    1181
    1182         List<Record> rows;
    1183         if (conn == null)
    1184         {
    1185             rows = BasePeer.doSelect(criteria);
    1186         }
    1187         else
    1188         {
    1189             rows = BasePeer.doSelect(criteria,conn);
    1190         }
    1191
    1192         List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
    1193
    1194         for (int i = 0; i < rows.size(); i++)
    1195         {
    1196             Record row =  rows.get(i);
    1197
    1198             Class omClass = TurbineUserGroupRolePeer.getOMClass();
    1199             TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
    1200                 .row2Object(row, 1, omClass);
    1201
    1202
    1203
    1204
    1205
    1206              omClass = TurbineGroupPeer.getOMClass();
    1207             TurbineGroup obj2 = (TurbineGroup) TurbineGroupPeer
    1208                 .row2Object( row, offset2, omClass);
    1209
    1210  boolean  newObject = true;
    1211             for (int j = 0; j < results.size(); j++)
    1212             {
    1213                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1214                 TurbineGroup temp_obj2 = (TurbineGroup) temp_obj1.getTurbineGroup();
    1215                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
    1216                 {
    1217                     newObject = false;
    1218                     temp_obj2.addTurbineUserGroupRole(obj1);
    1219                     break;
    1220                 }
    1221             }
    1222             if (newObject)
    1223             {
    1224                 obj2.initTurbineUserGroupRoles();
    1225                 obj2.addTurbineUserGroupRole(obj1);
    1226             }
    1227
    1228
    1229
    1230
    1231              omClass = TurbineRolePeer.getOMClass();
    1232             TurbineRole obj3 = (TurbineRole) TurbineRolePeer
    1233                 .row2Object( row, offset3, omClass);
    1234
    1235  newObject = true;
    1236             for (int j = 0; j < results.size(); j++)
    1237             {
    1238                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1239                 TurbineRole temp_obj3 = (TurbineRole) temp_obj1.getTurbineRole();
    1240                 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
    1241                 {
    1242                     newObject = false;
    1243                     temp_obj3.addTurbineUserGroupRole(obj1);
    1244                     break;
    1245                 }
    1246             }
    1247             if (newObject)
    1248             {
    1249                 obj3.initTurbineUserGroupRoles();
    1250                 obj3.addTurbineUserGroupRole(obj1);
    1251             }
    1252             results.add(obj1);
    1253         }
    1254         return results;
    1255     }
    1256
    1257
    1258
    1259
    1260     /**
    1261      * selects a collection of TurbineUserGroupRole objects pre-filled with
    1262      * all related objects.
    1263      *
    1264      * This method is protected by default in order to keep the public
    1265      * api reasonable.  You can provide public methods for those you
    1266      * actually need in TurbineUserGroupRolePeer.
    1267      *
    1268      * @throws TorqueException Any exceptions caught during processing will be
    1269      *         rethrown wrapped into a TorqueException.
    1270      */
    1271     protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineGroup(Criteria criteria)
    1272         throws TorqueException
    1273     {
    1274         return doSelectJoinAllExceptTurbineGroup(criteria, null);
    1275     }
    1276
    1277     /**
    1278      * selects a collection of TurbineUserGroupRole objects pre-filled with
    1279      * all related objects.
    1280      *
    1281      * This method is protected by default in order to keep the public
    1282      * api reasonable.  You can provide public methods for those you
    1283      * actually need in TurbineUserGroupRolePeer.
    1284      *
    1285      * @throws TorqueException Any exceptions caught during processing will be
    1286      *         rethrown wrapped into a TorqueException.
    1287      */
    1288     protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineGroup(Criteria criteria, Connection conn)
    1289         throws TorqueException
    1290     {
    1291         setDbName(criteria);
    1292
    1293         addSelectColumns(criteria);
    1294         int offset2 = numColumns + 1;
    1295
    1296         TurbineUserPeer.addSelectColumns(criteria);
    1297         criteria.addJoin(TurbineUserGroupRolePeer.USER_ID, TurbineUserPeer.USER_ID);
    1298         int offset3 = offset2 + TurbineUserPeer.numColumns;
    1299
    1300
    1301         TurbineRolePeer.addSelectColumns(criteria);
    1302         criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID, TurbineRolePeer.ROLE_ID);
    1303
    1304         correctBooleans(criteria);
    1305
    1306         List<Record> rows;
    1307         if (conn == null)
    1308         {
    1309             rows = BasePeer.doSelect(criteria);
    1310         }
    1311         else
    1312         {
    1313             rows = BasePeer.doSelect(criteria,conn);
    1314         }
    1315
    1316         List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
    1317
    1318         for (int i = 0; i < rows.size(); i++)
    1319         {
    1320             Record row =  rows.get(i);
    1321
    1322             Class omClass = TurbineUserGroupRolePeer.getOMClass();
    1323             TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
    1324                 .row2Object(row, 1, omClass);
    1325
    1326
    1327
    1328
    1329              omClass = TurbineUserPeer.getOMClass();
    1330             TurbineUser obj2 = (TurbineUser) TurbineUserPeer
    1331                 .row2Object( row, offset2, omClass);
    1332
    1333  boolean  newObject = true;
    1334             for (int j = 0; j < results.size(); j++)
    1335             {
    1336                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1337                 TurbineUser temp_obj2 = (TurbineUser) temp_obj1.getTurbineUser();
    1338                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
    1339                 {
    1340                     newObject = false;
    1341                     temp_obj2.addTurbineUserGroupRole(obj1);
    1342                     break;
    1343                 }
    1344             }
    1345             if (newObject)
    1346             {
    1347                 obj2.initTurbineUserGroupRoles();
    1348                 obj2.addTurbineUserGroupRole(obj1);
    1349             }
    1350
    1351
    1352
    1353
    1354
    1355              omClass = TurbineRolePeer.getOMClass();
    1356             TurbineRole obj3 = (TurbineRole) TurbineRolePeer
    1357                 .row2Object( row, offset3, omClass);
    1358
    1359  newObject = true;
    1360             for (int j = 0; j < results.size(); j++)
    1361             {
    1362                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1363                 TurbineRole temp_obj3 = (TurbineRole) temp_obj1.getTurbineRole();
    1364                 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
    1365                 {
    1366                     newObject = false;
    1367                     temp_obj3.addTurbineUserGroupRole(obj1);
    1368                     break;
    1369                 }
    1370             }
    1371             if (newObject)
    1372             {
    1373                 obj3.initTurbineUserGroupRoles();
    1374                 obj3.addTurbineUserGroupRole(obj1);
    1375             }
    1376             results.add(obj1);
    1377         }
    1378         return results;
    1379     }
    1380
    1381
    1382
    1383
    1384     /**
    1385      * selects a collection of TurbineUserGroupRole objects pre-filled with
    1386      * all related objects.
    1387      *
    1388      * This method is protected by default in order to keep the public
    1389      * api reasonable.  You can provide public methods for those you
    1390      * actually need in TurbineUserGroupRolePeer.
    1391      *
    1392      * @throws TorqueException Any exceptions caught during processing will be
    1393      *         rethrown wrapped into a TorqueException.
    1394      */
    1395     protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineRole(Criteria criteria)
    1396         throws TorqueException
    1397     {
    1398         return doSelectJoinAllExceptTurbineRole(criteria, null);
    1399     }
    1400
    1401     /**
    1402      * selects a collection of TurbineUserGroupRole objects pre-filled with
    1403      * all related objects.
    1404      *
    1405      * This method is protected by default in order to keep the public
    1406      * api reasonable.  You can provide public methods for those you
    1407      * actually need in TurbineUserGroupRolePeer.
    1408      *
    1409      * @throws TorqueException Any exceptions caught during processing will be
    1410      *         rethrown wrapped into a TorqueException.
    1411      */
    1412     protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineRole(Criteria criteria, Connection conn)
    1413         throws TorqueException
    1414     {
    1415         setDbName(criteria);
    1416
    1417         addSelectColumns(criteria);
    1418         int offset2 = numColumns + 1;
    1419
    1420         TurbineUserPeer.addSelectColumns(criteria);
    1421         criteria.addJoin(TurbineUserGroupRolePeer.USER_ID, TurbineUserPeer.USER_ID);
    1422         int offset3 = offset2 + TurbineUserPeer.numColumns;
    1423
    1424         TurbineGroupPeer.addSelectColumns(criteria);
    1425         criteria.addJoin(TurbineUserGroupRolePeer.GROUP_ID, TurbineGroupPeer.GROUP_ID);
    1426
    1427
    1428         correctBooleans(criteria);
    1429
    1430         List<Record> rows;
    1431         if (conn == null)
    1432         {
    1433             rows = BasePeer.doSelect(criteria);
    1434         }
    1435         else
    1436         {
    1437             rows = BasePeer.doSelect(criteria,conn);
    1438         }
    1439
    1440         List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
    1441
    1442         for (int i = 0; i < rows.size(); i++)
    1443         {
    1444             Record row =  rows.get(i);
    1445
    1446             Class omClass = TurbineUserGroupRolePeer.getOMClass();
    1447             TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
    1448                 .row2Object(row, 1, omClass);
    1449
    1450
    1451
    1452
    1453              omClass = TurbineUserPeer.getOMClass();
    1454             TurbineUser obj2 = (TurbineUser) TurbineUserPeer
    1455                 .row2Object( row, offset2, omClass);
    1456
    1457  boolean  newObject = true;
    1458             for (int j = 0; j < results.size(); j++)
    1459             {
    1460                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1461                 TurbineUser temp_obj2 = (TurbineUser) temp_obj1.getTurbineUser();
    1462                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
    1463                 {
    1464                     newObject = false;
    1465                     temp_obj2.addTurbineUserGroupRole(obj1);
    1466                     break;
    1467                 }
    1468             }
    1469             if (newObject)
    1470             {
    1471                 obj2.initTurbineUserGroupRoles();
    1472                 obj2.addTurbineUserGroupRole(obj1);
    1473             }
    1474
    1475
    1476
    1477
    1478              omClass = TurbineGroupPeer.getOMClass();
    1479             TurbineGroup obj3 = (TurbineGroup) TurbineGroupPeer
    1480                 .row2Object( row, offset3, omClass);
    1481
    1482  newObject = true;
    1483             for (int j = 0; j < results.size(); j++)
    1484             {
    1485                 TurbineUserGroupRole temp_obj1 =  results.get(j);
    1486                 TurbineGroup temp_obj3 = (TurbineGroup) temp_obj1.getTurbineGroup();
    1487                 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
    1488                 {
    1489                     newObject = false;
    1490                     temp_obj3.addTurbineUserGroupRole(obj1);
    1491                     break;
    1492                 }
    1493             }
    1494             if (newObject)
    1495             {
    1496                 obj3.initTurbineUserGroupRoles();
    1497                 obj3.addTurbineUserGroupRole(obj1);
    1498             }
    1499
    1500             results.add(obj1);
    1501         }
    1502         return results;
    1503     }
    1504
    1505
    1506     /**
    1507      * Returns the TableMap related to this peer.
    1508      *
    1509      * @throws TorqueException Any exceptions caught during processing will be
    1510      *         rethrown wrapped into a TorqueException.
    1511      */
    1512     public static TableMap getTableMap()
    1513         throws TorqueException
    1514     {
    1515         return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
    1516     }
    1517
    1518     private static void setDbName(Criteria crit)
    1519     {
    1520         // Set the correct dbName if it has not been overridden
    1521         // crit.getDbName will return the same object if not set to
    1522         // another value so == check is okay and faster
    1523         if (crit.getDbName() == Torque.getDefaultDB())
    1524         {
    1525             crit.setDbName(DATABASE_NAME);
    1526         }
    1527     }
    1528
    1529
    1530     // The following methods wrap some methods in BasePeer
    1531     // to have more support for Java5 generic types in the Peer
    1532
    1533     /**
    1534      * Utility method which executes a given sql statement.  This
    1535      * method should be used for select statements only.  Use
    1536      * executeStatement for update, insert, and delete operations.
    1537      *
    1538      * @param queryString A String with the sql statement to execute.
    1539      * @return List of Record objects.
    1540      * @throws TorqueException Any exceptions caught during processing will be
    1541      *         rethrown wrapped into a TorqueException.
    1542      * @see org.apache.torque.util.BasePeer#executeQuery(String)
    1543      */
    1544     public static List<Record> executeQuery(String queryString) throws TorqueException
    1545     {
    1546         return BasePeer.executeQuery(queryString);
    1547     }
    1548
    1549     /**
    1550      * Utility method which executes a given sql statement.  This
    1551      * method should be used for select statements only.  Use
    1552      * executeStatement for update, insert, and delete operations.
    1553      *
    1554      * @param queryString A String with the sql statement to execute.
    1555      * @param dbName The database to connect to.
    1556      * @return List of Record objects.
    1557      * @throws TorqueException Any exceptions caught during processing will be
    1558      *         rethrown wrapped into a TorqueException.
    1559      * @see org.apache.torque.util.BasePeer#executeQuery(String,String)
    1560      */
    1561     public static List<Record> executeQuery(String queryString, String dbName)
    1562         throws TorqueException
    1563     {
    1564         return BasePeer.executeQuery(queryString,dbName);
    1565     }
    1566
    1567
    1568     /**
    1569      * Method for performing a SELECT.  Returns all results.
    1570      *
    1571      * @param queryString A String with the sql statement to execute.
    1572      * @param dbName The database to connect to.
    1573      * @param singleRecord Whether or not we want to select only a
    1574      * single record.
    1575      * @return List of Record objects.
    1576      * @throws TorqueException Any exceptions caught during processing will be
    1577      *         rethrown wrapped into a TorqueException.
    1578      * @see org.apache.torque.util.BasePeer#executeQuery(String,String,boolean)
    1579      */
    1580     public static List<Record> executeQuery(
    1581         String queryString,
    1582         String dbName,
    1583         boolean singleRecord)
    1584         throws TorqueException
    1585     {
    1586         return BasePeer.executeQuery(queryString,dbName,singleRecord);
    1587     }
    1588
    1589     /**
    1590      * Method for performing a SELECT.  Returns all results.
    1591      *
    1592      * @param queryString A String with the sql statement to execute.
    1593      * @param singleRecord Whether or not we want to select only a
    1594      * single record.
    1595      * @param con A Connection.
    1596      * @return List of Record objects.
    1597      * @throws TorqueException Any exceptions caught during processing will be
    1598      *         rethrown wrapped into a TorqueException.
    1599      * @see org.apache.torque.util.BasePeer#executeQuery(String,boolean,Connection)
    1600      */
    1601     public static List<Record> executeQuery(
    1602         String queryString,
    1603         boolean singleRecord,
    1604         Connection con)
    1605         throws TorqueException
    1606     {
    1607         return BasePeer.executeQuery(queryString,singleRecord,con);
    1608     }
    1609
    1610     /**
    1611      * Method for performing a SELECT.
    1612      *
    1613      * @param queryString A String with the sql statement to execute.
    1614      * @param start The first row to return.
    1615      * @param numberOfResults The number of rows to return.
    1616      * @param dbName The database to connect to.
    1617      * @param singleRecord Whether or not we want to select only a
    1618      * single record.
    1619      * @return List of Record objects.
    1620      * @throws TorqueException Any exceptions caught during processing will be
    1621      *         rethrown wrapped into a TorqueException.
    1622      * @see org.apache.torque.util.BasePeer#executeQuery(String,int,int,String,boolean)
    1623      */
    1624     public static List<Record> executeQuery(
    1625         String queryString,
    1626         int start,
    1627         int numberOfResults,
    1628         String dbName,
    1629         boolean singleRecord)
    1630         throws TorqueException
    1631     {
    1632         return BasePeer.executeQuery(queryString,start,numberOfResults,dbName,singleRecord);
    1633     }
    1634
    1635     /**
    1636      * Method for performing a SELECT.  Returns all results.
    1637      *
    1638      * @param queryString A String with the sql statement to execute.
    1639      * @param start The first row to return.
    1640      * @param numberOfResults The number of rows to return.
    1641      * @param singleRecord Whether or not we want to select only a
    1642      * single record.
    1643      * @param con A Connection.
    1644      * @return List of Record objects.
    1645      * @throws TorqueException Any exceptions caught during processing will be
    1646      *         rethrown wrapped into a TorqueException.
    1647      * @see org.apache.torque.util.BasePeer#executeQuery(String,int,int,String,boolean,Connection)
    1648      */
    1649     public static List<Record> executeQuery(
    1650         String queryString,
    1651         int start,
    1652         int numberOfResults,
    1653         boolean singleRecord,
    1654         Connection con)
    1655         throws TorqueException
    1656     {
    1657         return BasePeer.executeQuery(queryString,start,numberOfResults,singleRecord,con);
    1658     }
    1659
    1660     /**
    1661      * Returns all records in a QueryDataSet as a List of Record
    1662      * objects.  Used for functionality like util.LargeSelect.
    1663      *
    1664      * @see #getSelectResults(QueryDataSet, int, int, boolean)
    1665      * @param qds the QueryDataSet
    1666      * @return a List of Record objects
    1667      * @throws TorqueException Any exceptions caught during processing will be
    1668      *         rethrown wrapped into a TorqueException.
    1669      * @see org.apache.torque.util.BasePeer#getSelectResults(QueryDataSet)
    1670      */
    1671     public static List<Record> getSelectResults(QueryDataSet qds)
    1672         throws TorqueException
    1673     {
    1674         return BasePeer.getSelectResults(qds);
    1675     }
    1676
    1677     /**
    1678      * Returns all records in a QueryDataSet as a List of Record
    1679      * objects.  Used for functionality like util.LargeSelect.
    1680      *
    1681      * @see #getSelectResults(QueryDataSet, int, int, boolean)
    1682      * @param qds the QueryDataSet
    1683      * @param singleRecord
    1684      * @return a List of Record objects
    1685      * @throws TorqueException Any exceptions caught during processing will be
    1686      *         rethrown wrapped into a TorqueException.
    1687      * @see org.apache.torque.util.BasePeer#getSelectResults(QueryDataSet,boolean)
    1688      */
    1689     public static List<Record> getSelectResults(QueryDataSet qds, boolean singleRecord)
    1690         throws TorqueException
    1691     {
    1692         return BasePeer.getSelectResults(qds,singleRecord);
    1693     }
    1694
    1695     /**
    1696      * Returns numberOfResults records in a QueryDataSet as a List
    1697      * of Record objects.  Starting at record 0.  Used for
    1698      * functionality like util.LargeSelect.
    1699      *
    1700      * @see #getSelectResults(QueryDataSet, int, int, boolean)
    1701      * @param qds the QueryDataSet
    1702      * @param numberOfResults
    1703      * @param singleRecord
    1704      * @return a List of Record objects
    1705      * @throws TorqueException Any exceptions caught during processing will be
    1706      *         rethrown wrapped into a TorqueException.
    1707      * @see org.apache.torque.util.BasePeer#getSelectResults(QueryDataSet,int,boolean)
    1708      */
    1709     public static List<Record> getSelectResults(
    1710         QueryDataSet qds,
    1711         int numberOfResults,
    1712         boolean singleRecord)
    1713         throws TorqueException
    1714     {
    1715         return BasePeer.getSelectResults(qds,numberOfResults,singleRecord);
    1716     }
    1717
    1718     /**
    1719      * Returns numberOfResults records in a QueryDataSet as a List
    1720      * of Record objects.  Starting at record start.  Used for
    1721      * functionality like util.LargeSelect.
    1722      *
    1723      * @param qds The <code>QueryDataSet</code> to extract results
    1724      * from.
    1725      * @param start The index from which to start retrieving
    1726      * <code>Record</code> objects from the data set.
    1727      * @param numberOfResults The number of results to return (or
    1728      * <code> -1</code> for all results).
    1729      * @param singleRecord Whether or not we want to select only a
    1730      * single record.
    1731      * @return A <code>List</code> of <code>Record</code> objects.
    1732      * @exception TorqueException If any <code>Exception</code> occurs.
    1733      * @see org.apache.torque.util.BasePeer#getSelectResults(QueryDataSet,int,int,boolean)
    1734      */
    1735     public static List getSelectResults(
    1736         QueryDataSet qds,
    1737         int start,
    1738         int numberOfResults,
    1739         boolean singleRecord)
    1740         throws TorqueException
    1741     {
    1742         return BasePeer.getSelectResults(qds,start,numberOfResults,singleRecord);
    1743     }
    1744
    1745     /**
    1746      * Performs a SQL <code>select</code> using a PreparedStatement.
    1747      * Note: this method does not handle null criteria values.
    1748      *
    1749      * @param criteria
    1750      * @param con
    1751      * @return a List of Record objects.
    1752      * @throws TorqueException Error performing database query.
    1753      * @see org.apache.torque.util.BasePeer#doPSSelect(Criteria,Connection)
    1754      */
    1755     public static List<Record> doPSSelect(Criteria criteria, Connection con)
    1756         throws TorqueException
    1757     {
    1758         return BasePeer.doPSSelect(criteria,con);
    1759     }
    1760
    1761     /**
    1762      * Do a Prepared Statement select according to the given criteria
    1763      *
    1764      * @param criteria
    1765      * @return a List of Record objects.
    1766      * @throws TorqueException Any exceptions caught during processing will be
    1767      *         rethrown wrapped into a TorqueException.
    1768      * @see org.apache.torque.util.BasePeer#doPSSelect(Criteria)
    1769      */
    1770     public static List<Record> doPSSelect(Criteria criteria) throws TorqueException
    1771     {
    1772         return BasePeer.doPSSelect(criteria);
    1773     }
    1774 }