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