KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jetspeed > om > dbpsml > BaseJetspeedUserProfilePeer


1 package org.apache.jetspeed.om.dbpsml;
2
3 import java.math.BigDecimal JavaDoc;
4 import java.sql.Connection JavaDoc;
5 import java.sql.SQLException JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.util.Date JavaDoc;
8 import java.util.Iterator JavaDoc;
9 import java.util.LinkedList JavaDoc;
10 import java.util.List JavaDoc;
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.map.MapBuilder;
17 import org.apache.torque.map.TableMap;
18 import org.apache.torque.om.DateKey;
19 import org.apache.torque.om.NumberKey;
20 import org.apache.torque.om.StringKey;
21 import org.apache.torque.om.ObjectKey;
22 import org.apache.torque.om.SimpleKey;
23 import org.apache.torque.util.BasePeer;
24 import org.apache.torque.util.Criteria;
25
26 import com.workingdogs.village.DataSetException;
27 import com.workingdogs.village.QueryDataSet;
28 import com.workingdogs.village.Record;
29
30 // Local classes
31
import org.apache.jetspeed.om.dbpsml.map.*;
32
33
34 /**
35  * This class was autogenerated by Torque on:
36  *
37  * [Thu Apr 22 15:30:48 PDT 2004]
38  *
39  */

40 public abstract class BaseJetspeedUserProfilePeer
41     extends BasePeer
42 {
43
44     /** the default database name for this class */
45     public static final String JavaDoc DATABASE_NAME = "default";
46
47      /** the table name for this class */
48     public static final String JavaDoc TABLE_NAME = "JETSPEED_USER_PROFILE";
49
50     /**
51      * @return the map builder for this peer
52      * @throws TorqueException Any exceptions caught during processing will be
53      * rethrown wrapped into a TorqueException.
54      */

55     public static MapBuilder getMapBuilder()
56         throws TorqueException
57     {
58         return getMapBuilder(JetspeedUserProfileMapBuilder.CLASS_NAME);
59     }
60
61       /** the column name for the PSML_ID field */
62     public static final String JavaDoc PSML_ID;
63       /** the column name for the USER_NAME field */
64     public static final String JavaDoc USER_NAME;
65       /** the column name for the MEDIA_TYPE field */
66     public static final String JavaDoc MEDIA_TYPE;
67       /** the column name for the LANGUAGE field */
68     public static final String JavaDoc LANGUAGE;
69       /** the column name for the COUNTRY field */
70     public static final String JavaDoc COUNTRY;
71       /** the column name for the PAGE field */
72     public static final String JavaDoc PAGE;
73       /** the column name for the PROFILE field */
74     public static final String JavaDoc PROFILE;
75   
76     static
77     {
78           PSML_ID = "JETSPEED_USER_PROFILE.PSML_ID";
79           USER_NAME = "JETSPEED_USER_PROFILE.USER_NAME";
80           MEDIA_TYPE = "JETSPEED_USER_PROFILE.MEDIA_TYPE";
81           LANGUAGE = "JETSPEED_USER_PROFILE.LANGUAGE";
82           COUNTRY = "JETSPEED_USER_PROFILE.COUNTRY";
83           PAGE = "JETSPEED_USER_PROFILE.PAGE";
84           PROFILE = "JETSPEED_USER_PROFILE.PROFILE";
85           if (Torque.isInit())
86         {
87             try
88             {
89                 getMapBuilder();
90             }
91             catch (Exception JavaDoc e)
92             {
93                 log.error("Could not initialize Peer", e);
94             }
95         }
96         else
97         {
98             Torque.registerMapBuilder(JetspeedUserProfileMapBuilder.CLASS_NAME);
99         }
100     }
101  
102     /** number of columns for this peer */
103     public static final int numColumns = 7;
104
105     /** A class that can be returned by this peer. */
106     protected static final String JavaDoc CLASSNAME_DEFAULT =
107         "org.apache.jetspeed.om.dbpsml.JetspeedUserProfile";
108
109     /** A class that can be returned by this peer. */
110     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
111
112     /**
113      * Class object initialization method.
114      *
115      * @param className name of the class to initialize
116      * @return the initialized class
117      */

118     private static Class JavaDoc initClass(String JavaDoc className)
119     {
120         Class JavaDoc c = null;
121         try
122         {
123             c = Class.forName(className);
124         }
125         catch (Throwable JavaDoc t)
126         {
127             log.error("A FATAL ERROR has occurred which should not "
128                 + "have happened under any circumstance. Please notify "
129                 + "the Torque developers <turbine-torque-dev@jakarta.apache.org> "
130                 + "and give as many details as possible (including the error "
131                 + "stack trace).", t);
132
133             // Error objects should always be propogated.
134
if (t instanceof Error JavaDoc)
135             {
136                 throw (Error JavaDoc) t.fillInStackTrace();
137             }
138         }
139         return c;
140     }
141
142     /**
143      * Get the list of objects for a ResultSet. Please not that your
144      * resultset MUST return columns in the right order. You can use
145      * getFieldNames() in BaseObject to get the correct sequence.
146      *
147      * @param results the ResultSet
148      * @return the list of objects
149      * @throws TorqueException Any exceptions caught during processing will be
150      * rethrown wrapped into a TorqueException.
151      */

152     public static List JavaDoc resultSet2Objects(java.sql.ResultSet JavaDoc results)
153             throws TorqueException
154     {
155         try
156         {
157             QueryDataSet qds = null;
158             List JavaDoc rows = null;
159             try
160             {
161                 qds = new QueryDataSet(results);
162                 rows = getSelectResults(qds);
163             }
164             finally
165             {
166                 if (qds != null)
167                 {
168                     qds.close();
169                 }
170             }
171
172             return populateObjects(rows);
173         }
174         catch (SQLException JavaDoc e)
175         {
176             throw new TorqueException(e);
177         }
178         catch (DataSetException e)
179         {
180             throw new TorqueException(e);
181         }
182     }
183
184
185   
186     /**
187      * Method to do inserts.
188      *
189      * @param criteria object used to create the INSERT statement.
190      * @throws TorqueException Any exceptions caught during processing will be
191      * rethrown wrapped into a TorqueException.
192      */

193     public static ObjectKey doInsert(Criteria criteria)
194         throws TorqueException
195     {
196         return BaseJetspeedUserProfilePeer
197             .doInsert(criteria, (Connection JavaDoc) null);
198     }
199
200     /**
201      * Method to do inserts. This method is to be used during a transaction,
202      * otherwise use the doInsert(Criteria) method. It will take care of
203      * the connection details internally.
204      *
205      * @param criteria object used to create the INSERT statement.
206      * @param con the connection to use
207      * @throws TorqueException Any exceptions caught during processing will be
208      * rethrown wrapped into a TorqueException.
209      */

210     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
211         throws TorqueException
212     {
213                                             
214         // Set the correct dbName if it has not been overridden
215
// criteria.getDbName will return the same object if not set to
216
// another value so == check is okay and faster
217
if (criteria.getDbName() == Torque.getDefaultDB())
218         {
219             criteria.setDbName(DATABASE_NAME);
220         }
221         if (con == null)
222         {
223             return BasePeer.doInsert(criteria);
224         }
225         else
226         {
227             return BasePeer.doInsert(criteria, con);
228         }
229     }
230
231     /**
232      * Add all the columns needed to create a new object.
233      *
234      * @param criteria object containing the columns to add.
235      * @throws TorqueException Any exceptions caught during processing will be
236      * rethrown wrapped into a TorqueException.
237      */

238     public static void addSelectColumns(Criteria criteria)
239             throws TorqueException
240     {
241           criteria.addSelectColumn(PSML_ID);
242           criteria.addSelectColumn(USER_NAME);
243           criteria.addSelectColumn(MEDIA_TYPE);
244           criteria.addSelectColumn(LANGUAGE);
245           criteria.addSelectColumn(COUNTRY);
246           criteria.addSelectColumn(PAGE);
247           criteria.addSelectColumn(PROFILE);
248       }
249
250     /**
251      * Create a new object of type cls from a resultset row starting
252      * from a specified offset. This is done so that you can select
253      * other rows than just those needed for this object. You may
254      * for example want to create two objects from the same row.
255      *
256      * @throws TorqueException Any exceptions caught during processing will be
257      * rethrown wrapped into a TorqueException.
258      */

259     public static JetspeedUserProfile row2Object(Record row,
260                                              int offset,
261                                              Class JavaDoc cls)
262         throws TorqueException
263     {
264         try
265         {
266             JetspeedUserProfile obj = (JetspeedUserProfile) cls.newInstance();
267             JetspeedUserProfilePeer.populateObject(row, offset, obj);
268                   obj.setModified(false);
269               obj.setNew(false);
270
271             return obj;
272         }
273         catch (InstantiationException JavaDoc e)
274         {
275             throw new TorqueException(e);
276         }
277         catch (IllegalAccessException JavaDoc e)
278         {
279             throw new TorqueException(e);
280         }
281     }
282
283     /**
284      * Populates an object from a resultset row starting
285      * from a specified offset. This is done so that you can select
286      * other rows than just those needed for this object. You may
287      * for example want to create two objects from the same row.
288      *
289      * @throws TorqueException Any exceptions caught during processing will be
290      * rethrown wrapped into a TorqueException.
291      */

292     public static void populateObject(Record row,
293                                       int offset,
294                                       JetspeedUserProfile obj)
295         throws TorqueException
296     {
297         try
298         {
299                 obj.setPsmlId(row.getValue(offset + 0).asInt());
300                   obj.setUserName(row.getValue(offset + 1).asString());
301                   obj.setMediaType(row.getValue(offset + 2).asString());
302                   obj.setLanguage(row.getValue(offset + 3).asString());
303                   obj.setCountry(row.getValue(offset + 4).asString());
304                   obj.setPage(row.getValue(offset + 5).asString());
305                   obj.setProfile(row.getValue(offset + 6).asBytes());
306               }
307         catch (DataSetException e)
308         {
309             throw new TorqueException(e);
310         }
311     }
312
313     /**
314      * Method to do selects.
315      *
316      * @param criteria object used to create the SELECT statement.
317      * @return List of selected Objects
318      * @throws TorqueException Any exceptions caught during processing will be
319      * rethrown wrapped into a TorqueException.
320      */

321     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
322     {
323         return populateObjects(doSelectVillageRecords(criteria));
324     }
325
326     /**
327      * Method to do selects within a transaction.
328      *
329      * @param criteria object used to create the SELECT statement.
330      * @param con the connection to use
331      * @return List of selected Objects
332      * @throws TorqueException Any exceptions caught during processing will be
333      * rethrown wrapped into a TorqueException.
334      */

335     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
336         throws TorqueException
337     {
338         return populateObjects(doSelectVillageRecords(criteria, con));
339     }
340
341     /**
342      * Grabs the raw Village records to be formed into objects.
343      * This method handles connections internally. The Record objects
344      * returned by this method should be considered readonly. Do not
345      * alter the data and call save(), your results may vary, but are
346      * certainly likely to result in hard to track MT bugs.
347      *
348      * @throws TorqueException Any exceptions caught during processing will be
349      * rethrown wrapped into a TorqueException.
350      */

351     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
352         throws TorqueException
353     {
354         return BaseJetspeedUserProfilePeer
355             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
356     }
357
358     /**
359      * Grabs the raw Village records to be formed into objects.
360      * This method should be used for transactions
361      *
362      * @param con the connection to use
363      * @throws TorqueException Any exceptions caught during processing will be
364      * rethrown wrapped into a TorqueException.
365      */

366     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
367         throws TorqueException
368     {
369         if (criteria.getSelectColumns().size() == 0)
370         {
371             addSelectColumns(criteria);
372         }
373
374                                             
375         // Set the correct dbName if it has not been overridden
376
// criteria.getDbName will return the same object if not set to
377
// another value so == check is okay and faster
378
if (criteria.getDbName() == Torque.getDefaultDB())
379         {
380             criteria.setDbName(DATABASE_NAME);
381         }
382         // BasePeer returns a List of Value (Village) arrays. The array
383
// order follows the order columns were placed in the Select clause.
384
if (con == null)
385         {
386             return BasePeer.doSelect(criteria);
387         }
388         else
389         {
390             return BasePeer.doSelect(criteria, con);
391         }
392     }
393
394     /**
395      * The returned List will contain objects of the default type or
396      * objects that inherit from the default.
397      *
398      * @throws TorqueException Any exceptions caught during processing will be
399      * rethrown wrapped into a TorqueException.
400      */

401     public static List JavaDoc populateObjects(List JavaDoc records)
402         throws TorqueException
403     {
404         List JavaDoc results = new ArrayList JavaDoc(records.size());
405
406         // populate the object(s)
407
for (int i = 0; i < records.size(); i++)
408         {
409             Record row = (Record) records.get(i);
410               results.add(JetspeedUserProfilePeer.row2Object(row, 1,
411                 JetspeedUserProfilePeer.getOMClass()));
412           }
413         return results;
414     }
415  
416
417     /**
418      * The class that the Peer will make instances of.
419      * If the BO is abstract then you must implement this method
420      * in the BO.
421      *
422      * @throws TorqueException Any exceptions caught during processing will be
423      * rethrown wrapped into a TorqueException.
424      */

425     public static Class JavaDoc getOMClass()
426         throws TorqueException
427     {
428         return CLASS_DEFAULT;
429     }
430
431     /**
432      * Method to do updates.
433      *
434      * @param criteria object containing data that is used to create the UPDATE
435      * statement.
436      * @throws TorqueException Any exceptions caught during processing will be
437      * rethrown wrapped into a TorqueException.
438      */

439     public static void doUpdate(Criteria criteria) throws TorqueException
440     {
441          BaseJetspeedUserProfilePeer
442             .doUpdate(criteria, (Connection JavaDoc) null);
443     }
444
445     /**
446      * Method to do updates. This method is to be used during a transaction,
447      * otherwise use the doUpdate(Criteria) method. It will take care of
448      * the connection details internally.
449      *
450      * @param criteria object containing data that is used to create the UPDATE
451      * statement.
452      * @param con the connection to use
453      * @throws TorqueException Any exceptions caught during processing will be
454      * rethrown wrapped into a TorqueException.
455      */

456     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
457         throws TorqueException
458     {
459         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
460                    selectCriteria.put(PSML_ID, criteria.remove(PSML_ID));
461                                                                   
462         // Set the correct dbName if it has not been overridden
463
// criteria.getDbName will return the same object if not set to
464
// another value so == check is okay and faster
465
if (criteria.getDbName() == Torque.getDefaultDB())
466         {
467             criteria.setDbName(DATABASE_NAME);
468         }
469         if (con == null)
470         {
471             BasePeer.doUpdate(selectCriteria, criteria);
472         }
473         else
474         {
475             BasePeer.doUpdate(selectCriteria, criteria, con);
476         }
477     }
478
479     /**
480      * Method to do deletes.
481      *
482      * @param criteria object containing data that is used DELETE from database.
483      * @throws TorqueException Any exceptions caught during processing will be
484      * rethrown wrapped into a TorqueException.
485      */

486      public static void doDelete(Criteria criteria) throws TorqueException
487      {
488          BaseJetspeedUserProfilePeer
489             .doDelete(criteria, (Connection JavaDoc) null);
490      }
491
492     /**
493      * Method to do deletes. This method is to be used during a transaction,
494      * otherwise use the doDelete(Criteria) method. It will take care of
495      * the connection details internally.
496      *
497      * @param criteria object containing data that is used DELETE from database.
498      * @param con the connection to use
499      * @throws TorqueException Any exceptions caught during processing will be
500      * rethrown wrapped into a TorqueException.
501      */

502      public static void doDelete(Criteria criteria, Connection JavaDoc con)
503         throws TorqueException
504      {
505                                             
506         // Set the correct dbName if it has not been overridden
507
// criteria.getDbName will return the same object if not set to
508
// another value so == check is okay and faster
509
if (criteria.getDbName() == Torque.getDefaultDB())
510         {
511             criteria.setDbName(DATABASE_NAME);
512         }
513         if (con == null)
514         {
515             BasePeer.doDelete(criteria);
516         }
517         else
518         {
519             BasePeer.doDelete(criteria, con);
520         }
521      }
522
523     /**
524      * Method to do selects
525      *
526      * @throws TorqueException Any exceptions caught during processing will be
527      * rethrown wrapped into a TorqueException.
528      */

529     public static List JavaDoc doSelect(JetspeedUserProfile obj) throws TorqueException
530     {
531         return doSelect(buildCriteria(obj));
532     }
533
534     /**
535      * Method to do inserts
536      *
537      * @throws TorqueException Any exceptions caught during processing will be
538      * rethrown wrapped into a TorqueException.
539      */

540     public static void doInsert(JetspeedUserProfile obj) throws TorqueException
541     {
542           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
543           obj.setNew(false);
544         obj.setModified(false);
545     }
546
547     /**
548      * @param obj the data object to update in the database.
549      * @throws TorqueException Any exceptions caught during processing will be
550      * rethrown wrapped into a TorqueException.
551      */

552     public static void doUpdate(JetspeedUserProfile obj) throws TorqueException
553     {
554         doUpdate(buildCriteria(obj));
555         obj.setModified(false);
556     }
557
558     /**
559      * @param obj the data object to delete in the database.
560      * @throws TorqueException Any exceptions caught during processing will be
561      * rethrown wrapped into a TorqueException.
562      */

563     public static void doDelete(JetspeedUserProfile obj) throws TorqueException
564     {
565         doDelete(buildCriteria(obj));
566     }
567
568     /**
569      * Method to do inserts. This method is to be used during a transaction,
570      * otherwise use the doInsert(JetspeedUserProfile) method. It will take
571      * care of the connection details internally.
572      *
573      * @param obj the data object to insert into the database.
574      * @param con the connection to use
575      * @throws TorqueException Any exceptions caught during processing will be
576      * rethrown wrapped into a TorqueException.
577      */

578     public static void doInsert(JetspeedUserProfile obj, Connection JavaDoc con)
579         throws TorqueException
580     {
581           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
582           obj.setNew(false);
583         obj.setModified(false);
584     }
585
586     /**
587      * Method to do update. This method is to be used during a transaction,
588      * otherwise use the doUpdate(JetspeedUserProfile) method. It will take
589      * care of the connection details internally.
590      *
591      * @param obj the data object to update in the database.
592      * @param con the connection to use
593      * @throws TorqueException Any exceptions caught during processing will be
594      * rethrown wrapped into a TorqueException.
595      */

596     public static void doUpdate(JetspeedUserProfile obj, Connection JavaDoc con)
597         throws TorqueException
598     {
599         doUpdate(buildCriteria(obj), con);
600         obj.setModified(false);
601     }
602
603     /**
604      * Method to delete. This method is to be used during a transaction,
605      * otherwise use the doDelete(JetspeedUserProfile) method. It will take
606      * care of the connection details internally.
607      *
608      * @param obj the data object to delete in the database.
609      * @param con the connection to use
610      * @throws TorqueException Any exceptions caught during processing will be
611      * rethrown wrapped into a TorqueException.
612      */

613     public static void doDelete(JetspeedUserProfile obj, Connection JavaDoc con)
614         throws TorqueException
615     {
616         doDelete(buildCriteria(obj), con);
617     }
618
619     /**
620      * Method to do deletes.
621      *
622      * @param pk ObjectKey that is used DELETE from database.
623      * @throws TorqueException Any exceptions caught during processing will be
624      * rethrown wrapped into a TorqueException.
625      */

626     public static void doDelete(ObjectKey pk) throws TorqueException
627     {
628         BaseJetspeedUserProfilePeer
629            .doDelete(pk, (Connection JavaDoc) null);
630     }
631
632     /**
633      * Method to delete. This method is to be used during a transaction,
634      * otherwise use the doDelete(ObjectKey) method. It will take
635      * care of the connection details internally.
636      *
637      * @param pk the primary key for the object to delete in the database.
638      * @param con the connection to use
639      * @throws TorqueException Any exceptions caught during processing will be
640      * rethrown wrapped into a TorqueException.
641      */

642     public static void doDelete(ObjectKey pk, Connection JavaDoc con)
643         throws TorqueException
644     {
645         doDelete(buildCriteria(pk), con);
646     }
647
648     /** Build a Criteria object from an ObjectKey */
649     public static Criteria buildCriteria( ObjectKey pk )
650     {
651         Criteria criteria = new Criteria();
652               criteria.add(PSML_ID, pk);
653           return criteria;
654      }
655
656     /** Build a Criteria object from the data object for this peer */
657     public static Criteria buildCriteria( JetspeedUserProfile obj )
658     {
659         Criteria criteria = new Criteria(DATABASE_NAME);
660               if (!obj.isNew())
661                 criteria.add(PSML_ID, obj.getPsmlId());
662                   criteria.add(USER_NAME, obj.getUserName());
663                   criteria.add(MEDIA_TYPE, obj.getMediaType());
664                   criteria.add(LANGUAGE, obj.getLanguage());
665                   criteria.add(COUNTRY, obj.getCountry());
666                   criteria.add(PAGE, obj.getPage());
667                   criteria.add(PROFILE, obj.getProfile());
668           return criteria;
669     }
670  
671     
672         /**
673      * Retrieve a single object by pk
674      *
675      * @param pk the primary key
676      * @throws TorqueException Any exceptions caught during processing will be
677      * rethrown wrapped into a TorqueException.
678      * @throws NoRowsException Primary key was not found in database.
679      * @throws TooManyRowsException Primary key was not found in database.
680      */

681     public static JetspeedUserProfile retrieveByPK(int pk)
682         throws TorqueException, NoRowsException, TooManyRowsException
683     {
684         return retrieveByPK(SimpleKey.keyFor(pk));
685     }
686   
687     /**
688      * Retrieve a single object by pk
689      *
690      * @param pk the primary key
691      * @throws TorqueException Any exceptions caught during processing will be
692      * rethrown wrapped into a TorqueException.
693      * @throws NoRowsException Primary key was not found in database.
694      * @throws TooManyRowsException Primary key was not found in database.
695      */

696     public static JetspeedUserProfile retrieveByPK(ObjectKey pk)
697         throws TorqueException, NoRowsException, TooManyRowsException
698     {
699         Connection JavaDoc db = null;
700         JetspeedUserProfile retVal = null;
701         try
702         {
703             db = Torque.getConnection(DATABASE_NAME);
704             retVal = retrieveByPK(pk, db);
705         }
706         finally
707         {
708             Torque.closeConnection(db);
709         }
710         return(retVal);
711     }
712
713     /**
714      * Retrieve a single object by pk
715      *
716      * @param pk the primary key
717      * @param con the connection to use
718      * @throws TorqueException Any exceptions caught during processing will be
719      * rethrown wrapped into a TorqueException.
720      * @throws NoRowsException Primary key was not found in database.
721      * @throws TooManyRowsException Primary key was not found in database.
722      */

723     public static JetspeedUserProfile retrieveByPK(ObjectKey pk, Connection JavaDoc con)
724         throws TorqueException, NoRowsException, TooManyRowsException
725     {
726         Criteria criteria = buildCriteria(pk);
727         List JavaDoc v = doSelect(criteria, con);
728         if (v.size() == 0)
729         {
730             throw new NoRowsException("Failed to select a row.");
731         }
732         else if (v.size() > 1)
733         {
734             throw new TooManyRowsException("Failed to select only one row.");
735         }
736         else
737         {
738             return (JetspeedUserProfile)v.get(0);
739         }
740     }
741
742     /**
743      * Retrieve a multiple objects by pk
744      *
745      * @param pks List of primary keys
746      * @throws TorqueException Any exceptions caught during processing will be
747      * rethrown wrapped into a TorqueException.
748      */

749     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
750         throws TorqueException
751     {
752         Connection JavaDoc db = null;
753         List JavaDoc retVal = null;
754         try
755         {
756            db = Torque.getConnection(DATABASE_NAME);
757            retVal = retrieveByPKs(pks, db);
758         }
759         finally
760         {
761             Torque.closeConnection(db);
762         }
763         return(retVal);
764     }
765
766     /**
767      * Retrieve a multiple objects by pk
768      *
769      * @param pks List of primary keys
770      * @param dbcon the connection to use
771      * @throws TorqueException Any exceptions caught during processing will be
772      * rethrown wrapped into a TorqueException.
773      */

774     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
775         throws TorqueException
776     {
777         List JavaDoc objs = null;
778         if (pks == null || pks.size() == 0)
779         {
780             objs = new LinkedList JavaDoc();
781         }
782         else
783         {
784             Criteria criteria = new Criteria();
785               criteria.addIn( PSML_ID, pks );
786           objs = doSelect(criteria, dbcon);
787         }
788         return objs;
789     }
790
791  
792
793
794
795         
796   
797   
798     
799   
800       /**
801      * Returns the TableMap related to this peer. This method is not
802      * needed for general use but a specific application could have a need.
803      *
804      * @throws TorqueException Any exceptions caught during processing will be
805      * rethrown wrapped into a TorqueException.
806      */

807     protected static TableMap getTableMap()
808         throws TorqueException
809     {
810         return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
811     }
812    }
813
Popular Tags