KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > campware > cream > om > BaseCurrencyPeer


1 package org.campware.cream.om;
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.campware.cream.om.map.*;
32
33
34 /**
35  * This class was autogenerated by Torque on:
36  *
37  * [Wed May 04 09:10:56 CEST 2005]
38  *
39  */

40 public abstract class BaseCurrencyPeer
41     extends BasePeer
42 {
43
44     /** the default database name for this class */
45     public static final String JavaDoc DATABASE_NAME = "cream";
46
47      /** the table name for this class */
48     public static final String JavaDoc TABLE_NAME = "CURRENCY";
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(CurrencyMapBuilder.CLASS_NAME);
59     }
60
61       /** the column name for the CURRENCY_ID field */
62     public static final String JavaDoc CURRENCY_ID;
63       /** the column name for the CURRENCY_NAME field */
64     public static final String JavaDoc CURRENCY_NAME;
65       /** the column name for the CURRENCY_CODE field */
66     public static final String JavaDoc CURRENCY_CODE;
67       /** the column name for the CURRENCY_RATE field */
68     public static final String JavaDoc CURRENCY_RATE;
69   
70     static
71     {
72           CURRENCY_ID = "CURRENCY.CURRENCY_ID";
73           CURRENCY_NAME = "CURRENCY.CURRENCY_NAME";
74           CURRENCY_CODE = "CURRENCY.CURRENCY_CODE";
75           CURRENCY_RATE = "CURRENCY.CURRENCY_RATE";
76           if (Torque.isInit())
77         {
78             try
79             {
80                 getMapBuilder(CurrencyMapBuilder.CLASS_NAME);
81             }
82             catch (Exception JavaDoc e)
83             {
84                 log.error("Could not initialize Peer", e);
85             }
86         }
87         else
88         {
89             Torque.registerMapBuilder(CurrencyMapBuilder.CLASS_NAME);
90         }
91     }
92  
93     /** number of columns for this peer */
94     public static final int numColumns = 4;
95
96     /** A class that can be returned by this peer. */
97     protected static final String JavaDoc CLASSNAME_DEFAULT =
98         "org.campware.cream.om.Currency";
99
100     /** A class that can be returned by this peer. */
101     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
102
103     /**
104      * Class object initialization method.
105      *
106      * @param className name of the class to initialize
107      * @return the initialized class
108      */

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

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

184     public static ObjectKey doInsert(Criteria criteria)
185         throws TorqueException
186     {
187         return BaseCurrencyPeer
188             .doInsert(criteria, (Connection JavaDoc) null);
189     }
190
191     /**
192      * Method to do inserts. This method is to be used during a transaction,
193      * otherwise use the doInsert(Criteria) method. It will take care of
194      * the connection details internally.
195      *
196      * @param criteria object used to create the INSERT statement.
197      * @param con the connection to use
198      * @throws TorqueException Any exceptions caught during processing will be
199      * rethrown wrapped into a TorqueException.
200      */

201     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
202         throws TorqueException
203     {
204                           
205         setDbName(criteria);
206
207         if (con == null)
208         {
209             return BasePeer.doInsert(criteria);
210         }
211         else
212         {
213             return BasePeer.doInsert(criteria, con);
214         }
215     }
216
217     /**
218      * Add all the columns needed to create a new object.
219      *
220      * @param criteria object containing the columns to add.
221      * @throws TorqueException Any exceptions caught during processing will be
222      * rethrown wrapped into a TorqueException.
223      */

224     public static void addSelectColumns(Criteria criteria)
225             throws TorqueException
226     {
227           criteria.addSelectColumn(CURRENCY_ID);
228           criteria.addSelectColumn(CURRENCY_NAME);
229           criteria.addSelectColumn(CURRENCY_CODE);
230           criteria.addSelectColumn(CURRENCY_RATE);
231       }
232
233     /**
234      * Create a new object of type cls from a resultset row starting
235      * from a specified offset. This is done so that you can select
236      * other rows than just those needed for this object. You may
237      * for example want to create two objects from the same row.
238      *
239      * @throws TorqueException Any exceptions caught during processing will be
240      * rethrown wrapped into a TorqueException.
241      */

242     public static Currency row2Object(Record row,
243                                              int offset,
244                                              Class JavaDoc cls)
245         throws TorqueException
246     {
247         try
248         {
249             Currency obj = (Currency) cls.newInstance();
250             CurrencyPeer.populateObject(row, offset, obj);
251                   obj.setModified(false);
252               obj.setNew(false);
253
254             return obj;
255         }
256         catch (InstantiationException JavaDoc e)
257         {
258             throw new TorqueException(e);
259         }
260         catch (IllegalAccessException JavaDoc e)
261         {
262             throw new TorqueException(e);
263         }
264     }
265
266     /**
267      * Populates an object from a resultset row starting
268      * from a specified offset. This is done so that you can select
269      * other rows than just those needed for this object. You may
270      * for example want to create two objects from the same row.
271      *
272      * @throws TorqueException Any exceptions caught during processing will be
273      * rethrown wrapped into a TorqueException.
274      */

275     public static void populateObject(Record row,
276                                       int offset,
277                                       Currency obj)
278         throws TorqueException
279     {
280         try
281         {
282                 obj.setCurrencyId(row.getValue(offset + 0).asInt());
283                   obj.setCurrencyName(row.getValue(offset + 1).asString());
284                   obj.setCurrencyCode(row.getValue(offset + 2).asString());
285                   obj.setCurrencyRate(row.getValue(offset + 3).asBigDecimal());
286               }
287         catch (DataSetException e)
288         {
289             throw new TorqueException(e);
290         }
291     }
292
293     /**
294      * Method to do selects.
295      *
296      * @param criteria object used to create the SELECT statement.
297      * @return List of selected Objects
298      * @throws TorqueException Any exceptions caught during processing will be
299      * rethrown wrapped into a TorqueException.
300      */

301     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
302     {
303         return populateObjects(doSelectVillageRecords(criteria));
304     }
305
306     /**
307      * Method to do selects within a transaction.
308      *
309      * @param criteria object used to create the SELECT statement.
310      * @param con the connection to use
311      * @return List of selected Objects
312      * @throws TorqueException Any exceptions caught during processing will be
313      * rethrown wrapped into a TorqueException.
314      */

315     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
316         throws TorqueException
317     {
318         return populateObjects(doSelectVillageRecords(criteria, con));
319     }
320
321     /**
322      * Grabs the raw Village records to be formed into objects.
323      * This method handles connections internally. The Record objects
324      * returned by this method should be considered readonly. Do not
325      * alter the data and call save(), your results may vary, but are
326      * certainly likely to result in hard to track MT bugs.
327      *
328      * @throws TorqueException Any exceptions caught during processing will be
329      * rethrown wrapped into a TorqueException.
330      */

331     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
332         throws TorqueException
333     {
334         return BaseCurrencyPeer
335             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
336     }
337
338     /**
339      * Grabs the raw Village records to be formed into objects.
340      * This method should be used for transactions
341      *
342      * @param criteria object used to create the SELECT statement.
343      * @param con the connection to use
344      * @throws TorqueException Any exceptions caught during processing will be
345      * rethrown wrapped into a TorqueException.
346      */

347     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
348         throws TorqueException
349     {
350         if (criteria.getSelectColumns().size() == 0)
351         {
352             addSelectColumns(criteria);
353         }
354
355                           
356         setDbName(criteria);
357
358         // BasePeer returns a List of Value (Village) arrays. The array
359
// order follows the order columns were placed in the Select clause.
360
if (con == null)
361         {
362             return BasePeer.doSelect(criteria);
363         }
364         else
365         {
366             return BasePeer.doSelect(criteria, con);
367         }
368     }
369
370     /**
371      * The returned List will contain objects of the default type or
372      * objects that inherit from the default.
373      *
374      * @throws TorqueException Any exceptions caught during processing will be
375      * rethrown wrapped into a TorqueException.
376      */

377     public static List JavaDoc populateObjects(List JavaDoc records)
378         throws TorqueException
379     {
380         List JavaDoc results = new ArrayList JavaDoc(records.size());
381
382         // populate the object(s)
383
for (int i = 0; i < records.size(); i++)
384         {
385             Record row = (Record) records.get(i);
386               results.add(CurrencyPeer.row2Object(row, 1,
387                 CurrencyPeer.getOMClass()));
388           }
389         return results;
390     }
391  
392
393     /**
394      * The class that the Peer will make instances of.
395      * If the BO is abstract then you must implement this method
396      * in the BO.
397      *
398      * @throws TorqueException Any exceptions caught during processing will be
399      * rethrown wrapped into a TorqueException.
400      */

401     public static Class JavaDoc getOMClass()
402         throws TorqueException
403     {
404         return CLASS_DEFAULT;
405     }
406
407     /**
408      * Method to do updates.
409      *
410      * @param criteria object containing data that is used to create the UPDATE
411      * statement.
412      * @throws TorqueException Any exceptions caught during processing will be
413      * rethrown wrapped into a TorqueException.
414      */

415     public static void doUpdate(Criteria criteria) throws TorqueException
416     {
417          BaseCurrencyPeer
418             .doUpdate(criteria, (Connection JavaDoc) null);
419     }
420
421     /**
422      * Method to do updates. This method is to be used during a transaction,
423      * otherwise use the doUpdate(Criteria) method. It will take care of
424      * the connection details internally.
425      *
426      * @param criteria object containing data that is used to create the UPDATE
427      * statement.
428      * @param con the connection to use
429      * @throws TorqueException Any exceptions caught during processing will be
430      * rethrown wrapped into a TorqueException.
431      */

432     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
433         throws TorqueException
434     {
435         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
436                    selectCriteria.put(CURRENCY_ID, criteria.remove(CURRENCY_ID));
437                                     
438         setDbName(criteria);
439
440         if (con == null)
441         {
442             BasePeer.doUpdate(selectCriteria, criteria);
443         }
444         else
445         {
446             BasePeer.doUpdate(selectCriteria, criteria, con);
447         }
448     }
449
450     /**
451      * Method to do deletes.
452      *
453      * @param criteria object containing data that is used DELETE from database.
454      * @throws TorqueException Any exceptions caught during processing will be
455      * rethrown wrapped into a TorqueException.
456      */

457      public static void doDelete(Criteria criteria) throws TorqueException
458      {
459          CurrencyPeer
460             .doDelete(criteria, (Connection JavaDoc) null);
461      }
462
463     /**
464      * Method to do deletes. This method is to be used during a transaction,
465      * otherwise use the doDelete(Criteria) method. It will take care of
466      * the connection details internally.
467      *
468      * @param criteria object containing data that is used DELETE from database.
469      * @param con the connection to use
470      * @throws TorqueException Any exceptions caught during processing will be
471      * rethrown wrapped into a TorqueException.
472      */

473      public static void doDelete(Criteria criteria, Connection JavaDoc con)
474         throws TorqueException
475      {
476                           
477         setDbName(criteria);
478
479         if (con == null)
480         {
481             BasePeer.doDelete(criteria);
482         }
483         else
484         {
485             BasePeer.doDelete(criteria, con);
486         }
487      }
488
489     /**
490      * Method to do selects
491      *
492      * @throws TorqueException Any exceptions caught during processing will be
493      * rethrown wrapped into a TorqueException.
494      */

495     public static List JavaDoc doSelect(Currency obj) throws TorqueException
496     {
497         return doSelect(buildSelectCriteria(obj));
498     }
499
500     /**
501      * Method to do inserts
502      *
503      * @throws TorqueException Any exceptions caught during processing will be
504      * rethrown wrapped into a TorqueException.
505      */

506     public static void doInsert(Currency obj) throws TorqueException
507     {
508           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
509           obj.setNew(false);
510         obj.setModified(false);
511     }
512
513     /**
514      * @param obj the data object to update in the database.
515      * @throws TorqueException Any exceptions caught during processing will be
516      * rethrown wrapped into a TorqueException.
517      */

518     public static void doUpdate(Currency obj) throws TorqueException
519     {
520         doUpdate(buildCriteria(obj));
521         obj.setModified(false);
522     }
523
524     /**
525      * @param obj the data object to delete in the database.
526      * @throws TorqueException Any exceptions caught during processing will be
527      * rethrown wrapped into a TorqueException.
528      */

529     public static void doDelete(Currency obj) throws TorqueException
530     {
531         doDelete(buildSelectCriteria(obj));
532     }
533
534     /**
535      * Method to do inserts. This method is to be used during a transaction,
536      * otherwise use the doInsert(Currency) method. It will take
537      * care of the connection details internally.
538      *
539      * @param obj the data object to insert into the database.
540      * @param con the connection to use
541      * @throws TorqueException Any exceptions caught during processing will be
542      * rethrown wrapped into a TorqueException.
543      */

544     public static void doInsert(Currency obj, Connection JavaDoc con)
545         throws TorqueException
546     {
547           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
548           obj.setNew(false);
549         obj.setModified(false);
550     }
551
552     /**
553      * Method to do update. This method is to be used during a transaction,
554      * otherwise use the doUpdate(Currency) method. It will take
555      * care of the connection details internally.
556      *
557      * @param obj the data object to update in the database.
558      * @param con the connection to use
559      * @throws TorqueException Any exceptions caught during processing will be
560      * rethrown wrapped into a TorqueException.
561      */

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

579     public static void doDelete(Currency obj, Connection JavaDoc con)
580         throws TorqueException
581     {
582         doDelete(buildSelectCriteria(obj), con);
583     }
584
585     /**
586      * Method to do deletes.
587      *
588      * @param pk ObjectKey that is used DELETE from database.
589      * @throws TorqueException Any exceptions caught during processing will be
590      * rethrown wrapped into a TorqueException.
591      */

592     public static void doDelete(ObjectKey pk) throws TorqueException
593     {
594         BaseCurrencyPeer
595            .doDelete(pk, (Connection JavaDoc) null);
596     }
597
598     /**
599      * Method to delete. This method is to be used during a transaction,
600      * otherwise use the doDelete(ObjectKey) method. It will take
601      * care of the connection details internally.
602      *
603      * @param pk the primary key for the 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(ObjectKey pk, Connection JavaDoc con)
609         throws TorqueException
610     {
611         doDelete(buildCriteria(pk), con);
612     }
613
614     /** Build a Criteria object from an ObjectKey */
615     public static Criteria buildCriteria( ObjectKey pk )
616     {
617         Criteria criteria = new Criteria();
618               criteria.add(CURRENCY_ID, pk);
619           return criteria;
620      }
621
622     /** Build a Criteria object from the data object for this peer */
623     public static Criteria buildCriteria( Currency obj )
624     {
625         Criteria criteria = new Criteria(DATABASE_NAME);
626               if (!obj.isNew())
627             criteria.add(CURRENCY_ID, obj.getCurrencyId());
628               criteria.add(CURRENCY_NAME, obj.getCurrencyName());
629               criteria.add(CURRENCY_CODE, obj.getCurrencyCode());
630               criteria.add(CURRENCY_RATE, obj.getCurrencyRate());
631           return criteria;
632     }
633
634     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
635     public static Criteria buildSelectCriteria( Currency obj )
636     {
637         Criteria criteria = new Criteria(DATABASE_NAME);
638               if (!obj.isNew())
639                     criteria.add(CURRENCY_ID, obj.getCurrencyId());
640                           criteria.add(CURRENCY_NAME, obj.getCurrencyName());
641                           criteria.add(CURRENCY_CODE, obj.getCurrencyCode());
642                           criteria.add(CURRENCY_RATE, obj.getCurrencyRate());
643               return criteria;
644     }
645  
646     
647         /**
648      * Retrieve a single object by pk
649      *
650      * @param pk the primary key
651      * @throws TorqueException Any exceptions caught during processing will be
652      * rethrown wrapped into a TorqueException.
653      * @throws NoRowsException Primary key was not found in database.
654      * @throws TooManyRowsException Primary key was not found in database.
655      */

656     public static Currency retrieveByPK(int pk)
657         throws TorqueException, NoRowsException, TooManyRowsException
658     {
659         return retrieveByPK(SimpleKey.keyFor(pk));
660     }
661
662     /**
663      * Retrieve a single object by pk
664      *
665      * @param pk the primary key
666      * @param con the connection to use
667      * @throws TorqueException Any exceptions caught during processing will be
668      * rethrown wrapped into a TorqueException.
669      * @throws NoRowsException Primary key was not found in database.
670      * @throws TooManyRowsException Primary key was not found in database.
671      */

672     public static Currency retrieveByPK(int pk, Connection JavaDoc con)
673         throws TorqueException, NoRowsException, TooManyRowsException
674     {
675         return retrieveByPK(SimpleKey.keyFor(pk), con);
676     }
677   
678     /**
679      * Retrieve a single object by pk
680      *
681      * @param pk the primary key
682      * @throws TorqueException Any exceptions caught during processing will be
683      * rethrown wrapped into a TorqueException.
684      * @throws NoRowsException Primary key was not found in database.
685      * @throws TooManyRowsException Primary key was not found in database.
686      */

687     public static Currency retrieveByPK(ObjectKey pk)
688         throws TorqueException, NoRowsException, TooManyRowsException
689     {
690         Connection JavaDoc db = null;
691         Currency retVal = null;
692         try
693         {
694             db = Torque.getConnection(DATABASE_NAME);
695             retVal = retrieveByPK(pk, db);
696         }
697         finally
698         {
699             Torque.closeConnection(db);
700         }
701         return(retVal);
702     }
703
704     /**
705      * Retrieve a single object by pk
706      *
707      * @param pk the primary key
708      * @param con the connection to use
709      * @throws TorqueException Any exceptions caught during processing will be
710      * rethrown wrapped into a TorqueException.
711      * @throws NoRowsException Primary key was not found in database.
712      * @throws TooManyRowsException Primary key was not found in database.
713      */

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

740     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
741         throws TorqueException
742     {
743         Connection JavaDoc db = null;
744         List JavaDoc retVal = null;
745         try
746         {
747            db = Torque.getConnection(DATABASE_NAME);
748            retVal = retrieveByPKs(pks, db);
749         }
750         finally
751         {
752             Torque.closeConnection(db);
753         }
754         return(retVal);
755     }
756
757     /**
758      * Retrieve a multiple objects by pk
759      *
760      * @param pks List of primary keys
761      * @param dbcon the connection to use
762      * @throws TorqueException Any exceptions caught during processing will be
763      * rethrown wrapped into a TorqueException.
764      */

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

798     protected static TableMap getTableMap()
799         throws TorqueException
800     {
801         return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
802     }
803    
804     private static void setDbName(Criteria crit)
805     {
806         // Set the correct dbName if it has not been overridden
807
// crit.getDbName will return the same object if not set to
808
// another value so == check is okay and faster
809
if (crit.getDbName() == Torque.getDefaultDB())
810         {
811             crit.setDbName(DATABASE_NAME);
812         }
813     }
814 }
815
Popular Tags