1 package org.apache.jetspeed.om.dbregistry;
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.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
31 import org.apache.jetspeed.om.dbregistry.map.*;
32
33
34 /***
35 * This class was autogenerated by Torque on:
36 *
37 * [Thu Apr 22 23:12:36 EDT 2004]
38 *
39 */
40 public abstract class BaseMediatypePeer
41 extends BasePeer
42 {
43
44 /*** the default database name for this class */
45 public static final String DATABASE_NAME = "default";
46
47 /*** the table name for this class */
48 public static final String TABLE_NAME = "MEDIATYPE";
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(MediatypeMapBuilder.CLASS_NAME);
59 }
60
61 /*** the column name for the ID field */
62 public static final String ID;
63 /*** the column name for the NAME field */
64 public static final String NAME;
65 /*** the column name for the HIDDEN field */
66 public static final String HIDDEN;
67 /*** the column name for the MIMETYPE field */
68 public static final String MIMETYPE;
69 /*** the column name for the ROLE field */
70 public static final String ROLE;
71 /*** the column name for the TITLE field */
72 public static final String TITLE;
73 /*** the column name for the DESCRIPTION field */
74 public static final String DESCRIPTION;
75 /*** the column name for the IMAGE field */
76 public static final String IMAGE;
77
78 static
79 {
80 ID = "MEDIATYPE.ID";
81 NAME = "MEDIATYPE.NAME";
82 HIDDEN = "MEDIATYPE.HIDDEN";
83 MIMETYPE = "MEDIATYPE.MIMETYPE";
84 ROLE = "MEDIATYPE.ROLE";
85 TITLE = "MEDIATYPE.TITLE";
86 DESCRIPTION = "MEDIATYPE.DESCRIPTION";
87 IMAGE = "MEDIATYPE.IMAGE";
88 if (Torque.isInit())
89 {
90 try
91 {
92 getMapBuilder();
93 }
94 catch (Exception e)
95 {
96 log.error("Could not initialize Peer", e);
97 }
98 }
99 else
100 {
101 Torque.registerMapBuilder(MediatypeMapBuilder.CLASS_NAME);
102 }
103 }
104
105 /*** number of columns for this peer */
106 public static final int numColumns = 8;
107
108 /*** A class that can be returned by this peer. */
109 protected static final String CLASSNAME_DEFAULT =
110 "org.apache.jetspeed.om.dbregistry.Mediatype";
111
112 /*** A class that can be returned by this peer. */
113 protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
114
115 /***
116 * Class object initialization method.
117 *
118 * @param className name of the class to initialize
119 * @return the initialized class
120 */
121 private static Class initClass(String className)
122 {
123 Class c = null;
124 try
125 {
126 c = Class.forName(className);
127 }
128 catch (Throwable t)
129 {
130 log.error("A FATAL ERROR has occurred which should not "
131 + "have happened under any circumstance. Please notify "
132 + "the Torque developers <turbine-torque-dev@jakarta.apache.org> "
133 + "and give as many details as possible (including the error "
134 + "stack trace).", t);
135
136
137 if (t instanceof Error)
138 {
139 throw (Error) t.fillInStackTrace();
140 }
141 }
142 return c;
143 }
144
145 /***
146 * Get the list of objects for a ResultSet. Please not that your
147 * resultset MUST return columns in the right order. You can use
148 * getFieldNames() in BaseObject to get the correct sequence.
149 *
150 * @param results the ResultSet
151 * @return the list of objects
152 * @throws TorqueException Any exceptions caught during processing will be
153 * rethrown wrapped into a TorqueException.
154 */
155 public static List resultSet2Objects(java.sql.ResultSet results)
156 throws TorqueException
157 {
158 try
159 {
160 QueryDataSet qds = null;
161 List rows = null;
162 try
163 {
164 qds = new QueryDataSet(results);
165 rows = getSelectResults(qds);
166 }
167 finally
168 {
169 if (qds != null)
170 {
171 qds.close();
172 }
173 }
174
175 return populateObjects(rows);
176 }
177 catch (SQLException e)
178 {
179 throw new TorqueException(e);
180 }
181 catch (DataSetException e)
182 {
183 throw new TorqueException(e);
184 }
185 }
186
187
188
189 /***
190 * Method to do inserts.
191 *
192 * @param criteria object used to create the INSERT statement.
193 * @throws TorqueException Any exceptions caught during processing will be
194 * rethrown wrapped into a TorqueException.
195 */
196 public static ObjectKey doInsert(Criteria criteria)
197 throws TorqueException
198 {
199 return BaseMediatypePeer
200 .doInsert(criteria, (Connection) null);
201 }
202
203 /***
204 * Method to do inserts. This method is to be used during a transaction,
205 * otherwise use the doInsert(Criteria) method. It will take care of
206 * the connection details internally.
207 *
208 * @param criteria object used to create the INSERT statement.
209 * @param con the connection to use
210 * @throws TorqueException Any exceptions caught during processing will be
211 * rethrown wrapped into a TorqueException.
212 */
213 public static ObjectKey doInsert(Criteria criteria, Connection con)
214 throws TorqueException
215 {
216
217 if (criteria.containsKey(HIDDEN))
218 {
219 Object possibleBoolean = criteria.get(HIDDEN);
220 if (possibleBoolean instanceof Boolean)
221 {
222 if (((Boolean) possibleBoolean).booleanValue())
223 {
224 criteria.add(HIDDEN, 1);
225 }
226 else
227 {
228 criteria.add(HIDDEN, 0);
229 }
230 }
231 }
232
233
234
235
236 if (criteria.getDbName() == Torque.getDefaultDB())
237 {
238 criteria.setDbName(DATABASE_NAME);
239 }
240 if (con == null)
241 {
242 return BasePeer.doInsert(criteria);
243 }
244 else
245 {
246 return BasePeer.doInsert(criteria, con);
247 }
248 }
249
250 /***
251 * Add all the columns needed to create a new object.
252 *
253 * @param criteria object containing the columns to add.
254 * @throws TorqueException Any exceptions caught during processing will be
255 * rethrown wrapped into a TorqueException.
256 */
257 public static void addSelectColumns(Criteria criteria)
258 throws TorqueException
259 {
260 criteria.addSelectColumn(ID);
261 criteria.addSelectColumn(NAME);
262 criteria.addSelectColumn(HIDDEN);
263 criteria.addSelectColumn(MIMETYPE);
264 criteria.addSelectColumn(ROLE);
265 criteria.addSelectColumn(TITLE);
266 criteria.addSelectColumn(DESCRIPTION);
267 criteria.addSelectColumn(IMAGE);
268 }
269
270 /***
271 * Create a new object of type cls from a resultset row starting
272 * from a specified offset. This is done so that you can select
273 * other rows than just those needed for this object. You may
274 * for example want to create two objects from the same row.
275 *
276 * @throws TorqueException Any exceptions caught during processing will be
277 * rethrown wrapped into a TorqueException.
278 */
279 public static Mediatype row2Object(Record row,
280 int offset,
281 Class cls)
282 throws TorqueException
283 {
284 try
285 {
286 Mediatype obj = (Mediatype) cls.newInstance();
287 MediatypePeer.populateObject(row, offset, obj);
288 obj.setModified(false);
289 obj.setNew(false);
290
291 return obj;
292 }
293 catch (InstantiationException e)
294 {
295 throw new TorqueException(e);
296 }
297 catch (IllegalAccessException e)
298 {
299 throw new TorqueException(e);
300 }
301 }
302
303 /***
304 * Populates an object from a resultset row starting
305 * from a specified offset. This is done so that you can select
306 * other rows than just those needed for this object. You may
307 * for example want to create two objects from the same row.
308 *
309 * @throws TorqueException Any exceptions caught during processing will be
310 * rethrown wrapped into a TorqueException.
311 */
312 public static void populateObject(Record row,
313 int offset,
314 Mediatype obj)
315 throws TorqueException
316 {
317 try
318 {
319 obj.setId(row.getValue(offset + 0).asLong());
320 obj.setName(row.getValue(offset + 1).asString());
321 obj.setHidden(row.getValue(offset + 2).asBoolean());
322 obj.setMimetype(row.getValue(offset + 3).asString());
323 obj.setRole(row.getValue(offset + 4).asString());
324 obj.setTitle(row.getValue(offset + 5).asString());
325 obj.setDescription(row.getValue(offset + 6).asString());
326 obj.setImage(row.getValue(offset + 7).asString());
327 }
328 catch (DataSetException e)
329 {
330 throw new TorqueException(e);
331 }
332 }
333
334 /***
335 * Method to do selects.
336 *
337 * @param criteria object used to create the SELECT statement.
338 * @return List of selected Objects
339 * @throws TorqueException Any exceptions caught during processing will be
340 * rethrown wrapped into a TorqueException.
341 */
342 public static List doSelect(Criteria criteria) throws TorqueException
343 {
344 return populateObjects(doSelectVillageRecords(criteria));
345 }
346
347 /***
348 * Method to do selects within a transaction.
349 *
350 * @param criteria object used to create the SELECT statement.
351 * @param con the connection to use
352 * @return List of selected Objects
353 * @throws TorqueException Any exceptions caught during processing will be
354 * rethrown wrapped into a TorqueException.
355 */
356 public static List doSelect(Criteria criteria, Connection con)
357 throws TorqueException
358 {
359 return populateObjects(doSelectVillageRecords(criteria, con));
360 }
361
362 /***
363 * Grabs the raw Village records to be formed into objects.
364 * This method handles connections internally. The Record objects
365 * returned by this method should be considered readonly. Do not
366 * alter the data and call save(), your results may vary, but are
367 * certainly likely to result in hard to track MT bugs.
368 *
369 * @throws TorqueException Any exceptions caught during processing will be
370 * rethrown wrapped into a TorqueException.
371 */
372 public static List doSelectVillageRecords(Criteria criteria)
373 throws TorqueException
374 {
375 return BaseMediatypePeer
376 .doSelectVillageRecords(criteria, (Connection) null);
377 }
378
379 /***
380 * Grabs the raw Village records to be formed into objects.
381 * This method should be used for transactions
382 *
383 * @param con the connection to use
384 * @throws TorqueException Any exceptions caught during processing will be
385 * rethrown wrapped into a TorqueException.
386 */
387 public static List doSelectVillageRecords(Criteria criteria, Connection con)
388 throws TorqueException
389 {
390 if (criteria.getSelectColumns().size() == 0)
391 {
392 addSelectColumns(criteria);
393 }
394
395
396 if (criteria.containsKey(HIDDEN))
397 {
398 Object possibleBoolean = criteria.get(HIDDEN);
399 if (possibleBoolean instanceof Boolean)
400 {
401 if (((Boolean) possibleBoolean).booleanValue())
402 {
403 criteria.add(HIDDEN, 1);
404 }
405 else
406 {
407 criteria.add(HIDDEN, 0);
408 }
409 }
410 }
411
412
413
414
415 if (criteria.getDbName() == Torque.getDefaultDB())
416 {
417 criteria.setDbName(DATABASE_NAME);
418 }
419
420
421 if (con == null)
422 {
423 return BasePeer.doSelect(criteria);
424 }
425 else
426 {
427 return BasePeer.doSelect(criteria, con);
428 }
429 }
430
431 /***
432 * The returned List will contain objects of the default type or
433 * objects that inherit from the default.
434 *
435 * @throws TorqueException Any exceptions caught during processing will be
436 * rethrown wrapped into a TorqueException.
437 */
438 public static List populateObjects(List records)
439 throws TorqueException
440 {
441 List results = new ArrayList(records.size());
442
443
444 for (int i = 0; i < records.size(); i++)
445 {
446 Record row = (Record) records.get(i);
447 results.add(MediatypePeer.row2Object(row, 1,
448 MediatypePeer.getOMClass()));
449 }
450 return results;
451 }
452
453
454 /***
455 * The class that the Peer will make instances of.
456 * If the BO is abstract then you must implement this method
457 * in the BO.
458 *
459 * @throws TorqueException Any exceptions caught during processing will be
460 * rethrown wrapped into a TorqueException.
461 */
462 public static Class getOMClass()
463 throws TorqueException
464 {
465 return CLASS_DEFAULT;
466 }
467
468 /***
469 * Method to do updates.
470 *
471 * @param criteria object containing data that is used to create the UPDATE
472 * statement.
473 * @throws TorqueException Any exceptions caught during processing will be
474 * rethrown wrapped into a TorqueException.
475 */
476 public static void doUpdate(Criteria criteria) throws TorqueException
477 {
478 BaseMediatypePeer
479 .doUpdate(criteria, (Connection) null);
480 }
481
482 /***
483 * Method to do updates. This method is to be used during a transaction,
484 * otherwise use the doUpdate(Criteria) method. It will take care of
485 * the connection details internally.
486 *
487 * @param criteria object containing data that is used to create the UPDATE
488 * statement.
489 * @param con the connection to use
490 * @throws TorqueException Any exceptions caught during processing will be
491 * rethrown wrapped into a TorqueException.
492 */
493 public static void doUpdate(Criteria criteria, Connection con)
494 throws TorqueException
495 {
496 Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
497 selectCriteria.put(ID, criteria.remove(ID));
498
499 if (criteria.containsKey(HIDDEN))
500 {
501 Object possibleBoolean = criteria.get(HIDDEN);
502 if (possibleBoolean instanceof Boolean)
503 {
504 if (((Boolean) possibleBoolean).booleanValue())
505 {
506 criteria.add(HIDDEN, 1);
507 }
508 else
509 {
510 criteria.add(HIDDEN, 0);
511 }
512 }
513 }
514
515
516
517
518 if (criteria.getDbName() == Torque.getDefaultDB())
519 {
520 criteria.setDbName(DATABASE_NAME);
521 }
522 if (con == null)
523 {
524 BasePeer.doUpdate(selectCriteria, criteria);
525 }
526 else
527 {
528 BasePeer.doUpdate(selectCriteria, criteria, con);
529 }
530 }
531
532 /***
533 * Method to do deletes.
534 *
535 * @param criteria object containing data that is used DELETE from database.
536 * @throws TorqueException Any exceptions caught during processing will be
537 * rethrown wrapped into a TorqueException.
538 */
539 public static void doDelete(Criteria criteria) throws TorqueException
540 {
541 BaseMediatypePeer
542 .doDelete(criteria, (Connection) null);
543 }
544
545 /***
546 * Method to do deletes. This method is to be used during a transaction,
547 * otherwise use the doDelete(Criteria) method. It will take care of
548 * the connection details internally.
549 *
550 * @param criteria object containing data that is used DELETE from database.
551 * @param con the connection to use
552 * @throws TorqueException Any exceptions caught during processing will be
553 * rethrown wrapped into a TorqueException.
554 */
555 public static void doDelete(Criteria criteria, Connection con)
556 throws TorqueException
557 {
558
559 if (criteria.containsKey(HIDDEN))
560 {
561 Object possibleBoolean = criteria.get(HIDDEN);
562 if (possibleBoolean instanceof Boolean)
563 {
564 if (((Boolean) possibleBoolean).booleanValue())
565 {
566 criteria.add(HIDDEN, 1);
567 }
568 else
569 {
570 criteria.add(HIDDEN, 0);
571 }
572 }
573 }
574
575
576
577
578 if (criteria.getDbName() == Torque.getDefaultDB())
579 {
580 criteria.setDbName(DATABASE_NAME);
581 }
582 if (con == null)
583 {
584 BasePeer.doDelete(criteria);
585 }
586 else
587 {
588 BasePeer.doDelete(criteria, con);
589 }
590 }
591
592 /***
593 * Method to do selects
594 *
595 * @throws TorqueException Any exceptions caught during processing will be
596 * rethrown wrapped into a TorqueException.
597 */
598 public static List doSelect(Mediatype obj) throws TorqueException
599 {
600 return doSelect(buildCriteria(obj));
601 }
602
603 /***
604 * Method to do inserts
605 *
606 * @throws TorqueException Any exceptions caught during processing will be
607 * rethrown wrapped into a TorqueException.
608 */
609 public static void doInsert(Mediatype obj) throws TorqueException
610 {
611 obj.setPrimaryKey(doInsert(buildCriteria(obj)));
612 obj.setNew(false);
613 obj.setModified(false);
614 }
615
616 /***
617 * @param obj the data object to update in the database.
618 * @throws TorqueException Any exceptions caught during processing will be
619 * rethrown wrapped into a TorqueException.
620 */
621 public static void doUpdate(Mediatype obj) throws TorqueException
622 {
623 doUpdate(buildCriteria(obj));
624 obj.setModified(false);
625 }
626
627 /***
628 * @param obj the data object to delete in the database.
629 * @throws TorqueException Any exceptions caught during processing will be
630 * rethrown wrapped into a TorqueException.
631 */
632 public static void doDelete(Mediatype obj) throws TorqueException
633 {
634 doDelete(buildCriteria(obj));
635 }
636
637 /***
638 * Method to do inserts. This method is to be used during a transaction,
639 * otherwise use the doInsert(Mediatype) method. It will take
640 * care of the connection details internally.
641 *
642 * @param obj the data object to insert into the database.
643 * @param con the connection to use
644 * @throws TorqueException Any exceptions caught during processing will be
645 * rethrown wrapped into a TorqueException.
646 */
647 public static void doInsert(Mediatype obj, Connection con)
648 throws TorqueException
649 {
650 obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
651 obj.setNew(false);
652 obj.setModified(false);
653 }
654
655 /***
656 * Method to do update. This method is to be used during a transaction,
657 * otherwise use the doUpdate(Mediatype) method. It will take
658 * care of the connection details internally.
659 *
660 * @param obj the data object to update in the database.
661 * @param con the connection to use
662 * @throws TorqueException Any exceptions caught during processing will be
663 * rethrown wrapped into a TorqueException.
664 */
665 public static void doUpdate(Mediatype obj, Connection con)
666 throws TorqueException
667 {
668 doUpdate(buildCriteria(obj), con);
669 obj.setModified(false);
670 }
671
672 /***
673 * Method to delete. This method is to be used during a transaction,
674 * otherwise use the doDelete(Mediatype) method. It will take
675 * care of the connection details internally.
676 *
677 * @param obj the data object to delete in the database.
678 * @param con the connection to use
679 * @throws TorqueException Any exceptions caught during processing will be
680 * rethrown wrapped into a TorqueException.
681 */
682 public static void doDelete(Mediatype obj, Connection con)
683 throws TorqueException
684 {
685 doDelete(buildCriteria(obj), con);
686 }
687
688 /***
689 * Method to do deletes.
690 *
691 * @param pk ObjectKey that is used DELETE from database.
692 * @throws TorqueException Any exceptions caught during processing will be
693 * rethrown wrapped into a TorqueException.
694 */
695 public static void doDelete(ObjectKey pk) throws TorqueException
696 {
697 BaseMediatypePeer
698 .doDelete(pk, (Connection) null);
699 }
700
701 /***
702 * Method to delete. This method is to be used during a transaction,
703 * otherwise use the doDelete(ObjectKey) method. It will take
704 * care of the connection details internally.
705 *
706 * @param pk the primary key for the object to delete in the database.
707 * @param con the connection to use
708 * @throws TorqueException Any exceptions caught during processing will be
709 * rethrown wrapped into a TorqueException.
710 */
711 public static void doDelete(ObjectKey pk, Connection con)
712 throws TorqueException
713 {
714 doDelete(buildCriteria(pk), con);
715 }
716
717 /*** Build a Criteria object from an ObjectKey */
718 public static Criteria buildCriteria( ObjectKey pk )
719 {
720 Criteria criteria = new Criteria();
721 criteria.add(ID, pk);
722 return criteria;
723 }
724
725 /*** Build a Criteria object from the data object for this peer */
726 public static Criteria buildCriteria( Mediatype obj )
727 {
728 Criteria criteria = new Criteria(DATABASE_NAME);
729 if (!obj.isNew())
730 criteria.add(ID, obj.getId());
731 criteria.add(NAME, obj.getName());
732 criteria.add(HIDDEN, obj.getHidden());
733 criteria.add(MIMETYPE, obj.getMimetype());
734 criteria.add(ROLE, obj.getRole());
735 criteria.add(TITLE, obj.getTitle());
736 criteria.add(DESCRIPTION, obj.getDescription());
737 criteria.add(IMAGE, obj.getImage());
738 return criteria;
739 }
740
741
742 /***
743 * Retrieve a single object by pk
744 *
745 * @param pk the primary key
746 * @throws TorqueException Any exceptions caught during processing will be
747 * rethrown wrapped into a TorqueException.
748 * @throws NoRowsException Primary key was not found in database.
749 * @throws TooManyRowsException Primary key was not found in database.
750 */
751 public static Mediatype retrieveByPK(long pk)
752 throws TorqueException, NoRowsException, TooManyRowsException
753 {
754 return retrieveByPK(SimpleKey.keyFor(pk));
755 }
756
757 /***
758 * Retrieve a single object by pk
759 *
760 * @param pk the primary key
761 * @throws TorqueException Any exceptions caught during processing will be
762 * rethrown wrapped into a TorqueException.
763 * @throws NoRowsException Primary key was not found in database.
764 * @throws TooManyRowsException Primary key was not found in database.
765 */
766 public static Mediatype retrieveByPK(ObjectKey pk)
767 throws TorqueException, NoRowsException, TooManyRowsException
768 {
769 Connection db = null;
770 Mediatype retVal = null;
771 try
772 {
773 db = Torque.getConnection(DATABASE_NAME);
774 retVal = retrieveByPK(pk, db);
775 }
776 finally
777 {
778 Torque.closeConnection(db);
779 }
780 return(retVal);
781 }
782
783 /***
784 * Retrieve a single object by pk
785 *
786 * @param pk the primary key
787 * @param con the connection to use
788 * @throws TorqueException Any exceptions caught during processing will be
789 * rethrown wrapped into a TorqueException.
790 * @throws NoRowsException Primary key was not found in database.
791 * @throws TooManyRowsException Primary key was not found in database.
792 */
793 public static Mediatype retrieveByPK(ObjectKey pk, Connection con)
794 throws TorqueException, NoRowsException, TooManyRowsException
795 {
796 Criteria criteria = buildCriteria(pk);
797 List v = doSelect(criteria, con);
798 if (v.size() == 0)
799 {
800 throw new NoRowsException("Failed to select a row.");
801 }
802 else if (v.size() > 1)
803 {
804 throw new TooManyRowsException("Failed to select only one row.");
805 }
806 else
807 {
808 return (Mediatype)v.get(0);
809 }
810 }
811
812 /***
813 * Retrieve a multiple objects by pk
814 *
815 * @param pks List of primary keys
816 * @throws TorqueException Any exceptions caught during processing will be
817 * rethrown wrapped into a TorqueException.
818 */
819 public static List retrieveByPKs(List pks)
820 throws TorqueException
821 {
822 Connection db = null;
823 List retVal = null;
824 try
825 {
826 db = Torque.getConnection(DATABASE_NAME);
827 retVal = retrieveByPKs(pks, db);
828 }
829 finally
830 {
831 Torque.closeConnection(db);
832 }
833 return(retVal);
834 }
835
836 /***
837 * Retrieve a multiple objects by pk
838 *
839 * @param pks List of primary keys
840 * @param dbcon the connection to use
841 * @throws TorqueException Any exceptions caught during processing will be
842 * rethrown wrapped into a TorqueException.
843 */
844 public static List retrieveByPKs( List pks, Connection dbcon )
845 throws TorqueException
846 {
847 List objs = null;
848 if (pks == null || pks.size() == 0)
849 {
850 objs = new LinkedList();
851 }
852 else
853 {
854 Criteria criteria = new Criteria();
855 criteria.addIn( ID, pks );
856 objs = doSelect(criteria, dbcon);
857 }
858 return objs;
859 }
860
861
862
863
864
865
866
867
868
869
870 /***
871 * Returns the TableMap related to this peer. This method is not
872 * needed for general use but a specific application could have a need.
873 *
874 * @throws TorqueException Any exceptions caught during processing will be
875 * rethrown wrapped into a TorqueException.
876 */
877 protected static TableMap getTableMap()
878 throws TorqueException
879 {
880 return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
881 }
882 }