KickJava   Java API By Example, From Geeks To Geeks.

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


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   
36   
37   
38   
39   
40 /**
41  * This class was autogenerated by Torque on:
42  *
43  * [Wed May 04 09:10:56 CEST 2005]
44  *
45  */

46 public abstract class BaseCustomerPeer
47     extends BasePeer
48 {
49
50     /** the default database name for this class */
51     public static final String JavaDoc DATABASE_NAME = "cream";
52
53      /** the table name for this class */
54     public static final String JavaDoc TABLE_NAME = "CUSTOMER";
55
56     /**
57      * @return the map builder for this peer
58      * @throws TorqueException Any exceptions caught during processing will be
59      * rethrown wrapped into a TorqueException.
60      */

61     public static MapBuilder getMapBuilder()
62         throws TorqueException
63     {
64         return getMapBuilder(CustomerMapBuilder.CLASS_NAME);
65     }
66
67       /** the column name for the CUSTOMER_ID field */
68     public static final String JavaDoc CUSTOMER_ID;
69       /** the column name for the CUSTOMER_CODE field */
70     public static final String JavaDoc CUSTOMER_CODE;
71       /** the column name for the STATUS field */
72     public static final String JavaDoc STATUS;
73       /** the column name for the PRIORITY field */
74     public static final String JavaDoc PRIORITY;
75       /** the column name for the CUSTOMER_TYPE field */
76     public static final String JavaDoc CUSTOMER_TYPE;
77       /** the column name for the CUSTOMER_CAT_ID field */
78     public static final String JavaDoc CUSTOMER_CAT_ID;
79       /** the column name for the CUSTOMER_NAME_1 field */
80     public static final String JavaDoc CUSTOMER_NAME_1;
81       /** the column name for the CUSTOMER_NAME_2 field */
82     public static final String JavaDoc CUSTOMER_NAME_2;
83       /** the column name for the CUSTOMER_DISPLAY field */
84     public static final String JavaDoc CUSTOMER_DISPLAY;
85       /** the column name for the DEAR field */
86     public static final String JavaDoc DEAR;
87       /** the column name for the ADDRESS_1 field */
88     public static final String JavaDoc ADDRESS_1;
89       /** the column name for the ADDRESS_2 field */
90     public static final String JavaDoc ADDRESS_2;
91       /** the column name for the CITY field */
92     public static final String JavaDoc CITY;
93       /** the column name for the ZIP field */
94     public static final String JavaDoc ZIP;
95       /** the column name for the STATE field */
96     public static final String JavaDoc STATE;
97       /** the column name for the COUNTRY_ID field */
98     public static final String JavaDoc COUNTRY_ID;
99       /** the column name for the REGION_ID field */
100     public static final String JavaDoc REGION_ID;
101       /** the column name for the PHONE_1 field */
102     public static final String JavaDoc PHONE_1;
103       /** the column name for the PHONE_2 field */
104     public static final String JavaDoc PHONE_2;
105       /** the column name for the FAX field */
106     public static final String JavaDoc FAX;
107       /** the column name for the EMAIL field */
108     public static final String JavaDoc EMAIL;
109       /** the column name for the EMAIL_FORMAT field */
110     public static final String JavaDoc EMAIL_FORMAT;
111       /** the column name for the SEND_NEWS field */
112     public static final String JavaDoc SEND_NEWS;
113       /** the column name for the WEB_URL field */
114     public static final String JavaDoc WEB_URL;
115       /** the column name for the LANGUAGE_ID field */
116     public static final String JavaDoc LANGUAGE_ID;
117       /** the column name for the GENDER field */
118     public static final String JavaDoc GENDER;
119       /** the column name for the EDUCATION_CAT_ID field */
120     public static final String JavaDoc EDUCATION_CAT_ID;
121       /** the column name for the HOUSEHOLD_CAT_ID field */
122     public static final String JavaDoc HOUSEHOLD_CAT_ID;
123       /** the column name for the CUSTOM_1 field */
124     public static final String JavaDoc CUSTOM_1;
125       /** the column name for the CUSTOM_2 field */
126     public static final String JavaDoc CUSTOM_2;
127       /** the column name for the CUSTOM_3 field */
128     public static final String JavaDoc CUSTOM_3;
129       /** the column name for the CUSTOM_4 field */
130     public static final String JavaDoc CUSTOM_4;
131       /** the column name for the CUSTOM_5 field */
132     public static final String JavaDoc CUSTOM_5;
133       /** the column name for the CUSTOM_6 field */
134     public static final String JavaDoc CUSTOM_6;
135       /** the column name for the NOTES field */
136     public static final String JavaDoc NOTES;
137       /** the column name for the CREATED field */
138     public static final String JavaDoc CREATED;
139       /** the column name for the MODIFIED field */
140     public static final String JavaDoc MODIFIED;
141       /** the column name for the CREATED_BY field */
142     public static final String JavaDoc CREATED_BY;
143       /** the column name for the MODIFIED_BY field */
144     public static final String JavaDoc MODIFIED_BY;
145   
146     static
147     {
148           CUSTOMER_ID = "CUSTOMER.CUSTOMER_ID";
149           CUSTOMER_CODE = "CUSTOMER.CUSTOMER_CODE";
150           STATUS = "CUSTOMER.STATUS";
151           PRIORITY = "CUSTOMER.PRIORITY";
152           CUSTOMER_TYPE = "CUSTOMER.CUSTOMER_TYPE";
153           CUSTOMER_CAT_ID = "CUSTOMER.CUSTOMER_CAT_ID";
154           CUSTOMER_NAME_1 = "CUSTOMER.CUSTOMER_NAME_1";
155           CUSTOMER_NAME_2 = "CUSTOMER.CUSTOMER_NAME_2";
156           CUSTOMER_DISPLAY = "CUSTOMER.CUSTOMER_DISPLAY";
157           DEAR = "CUSTOMER.DEAR";
158           ADDRESS_1 = "CUSTOMER.ADDRESS_1";
159           ADDRESS_2 = "CUSTOMER.ADDRESS_2";
160           CITY = "CUSTOMER.CITY";
161           ZIP = "CUSTOMER.ZIP";
162           STATE = "CUSTOMER.STATE";
163           COUNTRY_ID = "CUSTOMER.COUNTRY_ID";
164           REGION_ID = "CUSTOMER.REGION_ID";
165           PHONE_1 = "CUSTOMER.PHONE_1";
166           PHONE_2 = "CUSTOMER.PHONE_2";
167           FAX = "CUSTOMER.FAX";
168           EMAIL = "CUSTOMER.EMAIL";
169           EMAIL_FORMAT = "CUSTOMER.EMAIL_FORMAT";
170           SEND_NEWS = "CUSTOMER.SEND_NEWS";
171           WEB_URL = "CUSTOMER.WEB_URL";
172           LANGUAGE_ID = "CUSTOMER.LANGUAGE_ID";
173           GENDER = "CUSTOMER.GENDER";
174           EDUCATION_CAT_ID = "CUSTOMER.EDUCATION_CAT_ID";
175           HOUSEHOLD_CAT_ID = "CUSTOMER.HOUSEHOLD_CAT_ID";
176           CUSTOM_1 = "CUSTOMER.CUSTOM_1";
177           CUSTOM_2 = "CUSTOMER.CUSTOM_2";
178           CUSTOM_3 = "CUSTOMER.CUSTOM_3";
179           CUSTOM_4 = "CUSTOMER.CUSTOM_4";
180           CUSTOM_5 = "CUSTOMER.CUSTOM_5";
181           CUSTOM_6 = "CUSTOMER.CUSTOM_6";
182           NOTES = "CUSTOMER.NOTES";
183           CREATED = "CUSTOMER.CREATED";
184           MODIFIED = "CUSTOMER.MODIFIED";
185           CREATED_BY = "CUSTOMER.CREATED_BY";
186           MODIFIED_BY = "CUSTOMER.MODIFIED_BY";
187           if (Torque.isInit())
188         {
189             try
190             {
191                 getMapBuilder(CustomerMapBuilder.CLASS_NAME);
192             }
193             catch (Exception JavaDoc e)
194             {
195                 log.error("Could not initialize Peer", e);
196             }
197         }
198         else
199         {
200             Torque.registerMapBuilder(CustomerMapBuilder.CLASS_NAME);
201         }
202     }
203  
204     /** number of columns for this peer */
205     public static final int numColumns = 39;
206
207     /** A class that can be returned by this peer. */
208     protected static final String JavaDoc CLASSNAME_DEFAULT =
209         "org.campware.cream.om.Customer";
210
211     /** A class that can be returned by this peer. */
212     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
213
214     /**
215      * Class object initialization method.
216      *
217      * @param className name of the class to initialize
218      * @return the initialized class
219      */

220     private static Class JavaDoc initClass(String JavaDoc className)
221     {
222         Class JavaDoc c = null;
223         try
224         {
225             c = Class.forName(className);
226         }
227         catch (Throwable JavaDoc t)
228         {
229             log.error("A FATAL ERROR has occurred which should not "
230                 + "have happened under any circumstance. Please notify "
231                 + "the Torque developers <torque-dev@db.apache.org> "
232                 + "and give as many details as possible (including the error "
233                 + "stack trace).", t);
234
235             // Error objects should always be propogated.
236
if (t instanceof Error JavaDoc)
237             {
238                 throw (Error JavaDoc) t.fillInStackTrace();
239             }
240         }
241         return c;
242     }
243
244     /**
245      * Get the list of objects for a ResultSet. Please not that your
246      * resultset MUST return columns in the right order. You can use
247      * getFieldNames() in BaseObject to get the correct sequence.
248      *
249      * @param results the ResultSet
250      * @return the list of objects
251      * @throws TorqueException Any exceptions caught during processing will be
252      * rethrown wrapped into a TorqueException.
253      */

254     public static List JavaDoc resultSet2Objects(java.sql.ResultSet JavaDoc results)
255             throws TorqueException
256     {
257         try
258         {
259             QueryDataSet qds = null;
260             List JavaDoc rows = null;
261             try
262             {
263                 qds = new QueryDataSet(results);
264                 rows = getSelectResults(qds);
265             }
266             finally
267             {
268                 if (qds != null)
269                 {
270                     qds.close();
271                 }
272             }
273
274             return populateObjects(rows);
275         }
276         catch (SQLException JavaDoc e)
277         {
278             throw new TorqueException(e);
279         }
280         catch (DataSetException e)
281         {
282             throw new TorqueException(e);
283         }
284     }
285
286
287   
288     /**
289      * Method to do inserts.
290      *
291      * @param criteria object used to create the INSERT statement.
292      * @throws TorqueException Any exceptions caught during processing will be
293      * rethrown wrapped into a TorqueException.
294      */

295     public static ObjectKey doInsert(Criteria criteria)
296         throws TorqueException
297     {
298         return BaseCustomerPeer
299             .doInsert(criteria, (Connection JavaDoc) null);
300     }
301
302     /**
303      * Method to do inserts. This method is to be used during a transaction,
304      * otherwise use the doInsert(Criteria) method. It will take care of
305      * the connection details internally.
306      *
307      * @param criteria object used to create the INSERT statement.
308      * @param con the connection to use
309      * @throws TorqueException Any exceptions caught during processing will be
310      * rethrown wrapped into a TorqueException.
311      */

312     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
313         throws TorqueException
314     {
315                                                                                                                                                                                                                                             
316         setDbName(criteria);
317
318         if (con == null)
319         {
320             return BasePeer.doInsert(criteria);
321         }
322         else
323         {
324             return BasePeer.doInsert(criteria, con);
325         }
326     }
327
328     /**
329      * Add all the columns needed to create a new object.
330      *
331      * @param criteria object containing the columns to add.
332      * @throws TorqueException Any exceptions caught during processing will be
333      * rethrown wrapped into a TorqueException.
334      */

335     public static void addSelectColumns(Criteria criteria)
336             throws TorqueException
337     {
338           criteria.addSelectColumn(CUSTOMER_ID);
339           criteria.addSelectColumn(CUSTOMER_CODE);
340           criteria.addSelectColumn(STATUS);
341           criteria.addSelectColumn(PRIORITY);
342           criteria.addSelectColumn(CUSTOMER_TYPE);
343           criteria.addSelectColumn(CUSTOMER_CAT_ID);
344           criteria.addSelectColumn(CUSTOMER_NAME_1);
345           criteria.addSelectColumn(CUSTOMER_NAME_2);
346           criteria.addSelectColumn(CUSTOMER_DISPLAY);
347           criteria.addSelectColumn(DEAR);
348           criteria.addSelectColumn(ADDRESS_1);
349           criteria.addSelectColumn(ADDRESS_2);
350           criteria.addSelectColumn(CITY);
351           criteria.addSelectColumn(ZIP);
352           criteria.addSelectColumn(STATE);
353           criteria.addSelectColumn(COUNTRY_ID);
354           criteria.addSelectColumn(REGION_ID);
355           criteria.addSelectColumn(PHONE_1);
356           criteria.addSelectColumn(PHONE_2);
357           criteria.addSelectColumn(FAX);
358           criteria.addSelectColumn(EMAIL);
359           criteria.addSelectColumn(EMAIL_FORMAT);
360           criteria.addSelectColumn(SEND_NEWS);
361           criteria.addSelectColumn(WEB_URL);
362           criteria.addSelectColumn(LANGUAGE_ID);
363           criteria.addSelectColumn(GENDER);
364           criteria.addSelectColumn(EDUCATION_CAT_ID);
365           criteria.addSelectColumn(HOUSEHOLD_CAT_ID);
366           criteria.addSelectColumn(CUSTOM_1);
367           criteria.addSelectColumn(CUSTOM_2);
368           criteria.addSelectColumn(CUSTOM_3);
369           criteria.addSelectColumn(CUSTOM_4);
370           criteria.addSelectColumn(CUSTOM_5);
371           criteria.addSelectColumn(CUSTOM_6);
372           criteria.addSelectColumn(NOTES);
373           criteria.addSelectColumn(CREATED);
374           criteria.addSelectColumn(MODIFIED);
375           criteria.addSelectColumn(CREATED_BY);
376           criteria.addSelectColumn(MODIFIED_BY);
377       }
378
379     /**
380      * Create a new object of type cls from a resultset row starting
381      * from a specified offset. This is done so that you can select
382      * other rows than just those needed for this object. You may
383      * for example want to create two objects from the same row.
384      *
385      * @throws TorqueException Any exceptions caught during processing will be
386      * rethrown wrapped into a TorqueException.
387      */

388     public static Customer row2Object(Record row,
389                                              int offset,
390                                              Class JavaDoc cls)
391         throws TorqueException
392     {
393         try
394         {
395             Customer obj = (Customer) cls.newInstance();
396             CustomerPeer.populateObject(row, offset, obj);
397                   obj.setModified(false);
398               obj.setNew(false);
399
400             return obj;
401         }
402         catch (InstantiationException JavaDoc e)
403         {
404             throw new TorqueException(e);
405         }
406         catch (IllegalAccessException JavaDoc e)
407         {
408             throw new TorqueException(e);
409         }
410     }
411
412     /**
413      * Populates an object from a resultset row starting
414      * from a specified offset. This is done so that you can select
415      * other rows than just those needed for this object. You may
416      * for example want to create two objects from the same row.
417      *
418      * @throws TorqueException Any exceptions caught during processing will be
419      * rethrown wrapped into a TorqueException.
420      */

421     public static void populateObject(Record row,
422                                       int offset,
423                                       Customer obj)
424         throws TorqueException
425     {
426         try
427         {
428                 obj.setCustomerId(row.getValue(offset + 0).asInt());
429                   obj.setCustomerCode(row.getValue(offset + 1).asString());
430                   obj.setStatus(row.getValue(offset + 2).asInt());
431                   obj.setPriority(row.getValue(offset + 3).asInt());
432                   obj.setCustomerType(row.getValue(offset + 4).asInt());
433                   obj.setCustomerCatId(row.getValue(offset + 5).asInt());
434                   obj.setCustomerName1(row.getValue(offset + 6).asString());
435                   obj.setCustomerName2(row.getValue(offset + 7).asString());
436                   obj.setCustomerDisplay(row.getValue(offset + 8).asString());
437                   obj.setDear(row.getValue(offset + 9).asString());
438                   obj.setAddress1(row.getValue(offset + 10).asString());
439                   obj.setAddress2(row.getValue(offset + 11).asString());
440                   obj.setCity(row.getValue(offset + 12).asString());
441                   obj.setZip(row.getValue(offset + 13).asString());
442                   obj.setState(row.getValue(offset + 14).asString());
443                   obj.setCountryId(row.getValue(offset + 15).asInt());
444                   obj.setRegionId(row.getValue(offset + 16).asInt());
445                   obj.setPhone1(row.getValue(offset + 17).asString());
446                   obj.setPhone2(row.getValue(offset + 18).asString());
447                   obj.setFax(row.getValue(offset + 19).asString());
448                   obj.setEmail(row.getValue(offset + 20).asString());
449                   obj.setEmailFormat(row.getValue(offset + 21).asInt());
450                   obj.setSendNews(row.getValue(offset + 22).asInt());
451                   obj.setWebUrl(row.getValue(offset + 23).asString());
452                   obj.setLanguageId(row.getValue(offset + 24).asInt());
453                   obj.setGender(row.getValue(offset + 25).asInt());
454                   obj.setEducationCatId(row.getValue(offset + 26).asInt());
455                   obj.setHouseholdCatId(row.getValue(offset + 27).asInt());
456                   obj.setCustom1(row.getValue(offset + 28).asString());
457                   obj.setCustom2(row.getValue(offset + 29).asString());
458                   obj.setCustom3(row.getValue(offset + 30).asString());
459                   obj.setCustom4(row.getValue(offset + 31).asString());
460                   obj.setCustom5(row.getValue(offset + 32).asString());
461                   obj.setCustom6(row.getValue(offset + 33).asString());
462                   obj.setNotes(row.getValue(offset + 34).asString());
463                   obj.setCreated(row.getValue(offset + 35).asUtilDate());
464                   obj.setModified(row.getValue(offset + 36).asUtilDate());
465                   obj.setCreatedBy(row.getValue(offset + 37).asString());
466                   obj.setModifiedBy(row.getValue(offset + 38).asString());
467               }
468         catch (DataSetException e)
469         {
470             throw new TorqueException(e);
471         }
472     }
473
474     /**
475      * Method to do selects.
476      *
477      * @param criteria object used to create the SELECT statement.
478      * @return List of selected Objects
479      * @throws TorqueException Any exceptions caught during processing will be
480      * rethrown wrapped into a TorqueException.
481      */

482     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
483     {
484         return populateObjects(doSelectVillageRecords(criteria));
485     }
486
487     /**
488      * Method to do selects within a transaction.
489      *
490      * @param criteria object used to create the SELECT statement.
491      * @param con the connection to use
492      * @return List of selected Objects
493      * @throws TorqueException Any exceptions caught during processing will be
494      * rethrown wrapped into a TorqueException.
495      */

496     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
497         throws TorqueException
498     {
499         return populateObjects(doSelectVillageRecords(criteria, con));
500     }
501
502     /**
503      * Grabs the raw Village records to be formed into objects.
504      * This method handles connections internally. The Record objects
505      * returned by this method should be considered readonly. Do not
506      * alter the data and call save(), your results may vary, but are
507      * certainly likely to result in hard to track MT bugs.
508      *
509      * @throws TorqueException Any exceptions caught during processing will be
510      * rethrown wrapped into a TorqueException.
511      */

512     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
513         throws TorqueException
514     {
515         return BaseCustomerPeer
516             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
517     }
518
519     /**
520      * Grabs the raw Village records to be formed into objects.
521      * This method should be used for transactions
522      *
523      * @param criteria object used to create the SELECT statement.
524      * @param con the connection to use
525      * @throws TorqueException Any exceptions caught during processing will be
526      * rethrown wrapped into a TorqueException.
527      */

528     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
529         throws TorqueException
530     {
531         if (criteria.getSelectColumns().size() == 0)
532         {
533             addSelectColumns(criteria);
534         }
535
536                                                                                                                                                                                                                                             
537         setDbName(criteria);
538
539         // BasePeer returns a List of Value (Village) arrays. The array
540
// order follows the order columns were placed in the Select clause.
541
if (con == null)
542         {
543             return BasePeer.doSelect(criteria);
544         }
545         else
546         {
547             return BasePeer.doSelect(criteria, con);
548         }
549     }
550
551     /**
552      * The returned List will contain objects of the default type or
553      * objects that inherit from the default.
554      *
555      * @throws TorqueException Any exceptions caught during processing will be
556      * rethrown wrapped into a TorqueException.
557      */

558     public static List JavaDoc populateObjects(List JavaDoc records)
559         throws TorqueException
560     {
561         List JavaDoc results = new ArrayList JavaDoc(records.size());
562
563         // populate the object(s)
564
for (int i = 0; i < records.size(); i++)
565         {
566             Record row = (Record) records.get(i);
567               results.add(CustomerPeer.row2Object(row, 1,
568                 CustomerPeer.getOMClass()));
569           }
570         return results;
571     }
572  
573
574     /**
575      * The class that the Peer will make instances of.
576      * If the BO is abstract then you must implement this method
577      * in the BO.
578      *
579      * @throws TorqueException Any exceptions caught during processing will be
580      * rethrown wrapped into a TorqueException.
581      */

582     public static Class JavaDoc getOMClass()
583         throws TorqueException
584     {
585         return CLASS_DEFAULT;
586     }
587
588     /**
589      * Method to do updates.
590      *
591      * @param criteria object containing data that is used to create the UPDATE
592      * statement.
593      * @throws TorqueException Any exceptions caught during processing will be
594      * rethrown wrapped into a TorqueException.
595      */

596     public static void doUpdate(Criteria criteria) throws TorqueException
597     {
598          BaseCustomerPeer
599             .doUpdate(criteria, (Connection JavaDoc) null);
600     }
601
602     /**
603      * Method to do updates. This method is to be used during a transaction,
604      * otherwise use the doUpdate(Criteria) method. It will take care of
605      * the connection details internally.
606      *
607      * @param criteria object containing data that is used to create the UPDATE
608      * statement.
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 doUpdate(Criteria criteria, Connection JavaDoc con)
614         throws TorqueException
615     {
616         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
617                    selectCriteria.put(CUSTOMER_ID, criteria.remove(CUSTOMER_ID));
618                                                                                                                                                                                                                                                                                                                                                                                                   
619         setDbName(criteria);
620
621         if (con == null)
622         {
623             BasePeer.doUpdate(selectCriteria, criteria);
624         }
625         else
626         {
627             BasePeer.doUpdate(selectCriteria, criteria, con);
628         }
629     }
630
631     /**
632      * Method to do deletes.
633      *
634      * @param criteria object containing data that is used DELETE from database.
635      * @throws TorqueException Any exceptions caught during processing will be
636      * rethrown wrapped into a TorqueException.
637      */

638      public static void doDelete(Criteria criteria) throws TorqueException
639      {
640          CustomerPeer
641             .doDelete(criteria, (Connection JavaDoc) null);
642      }
643
644     /**
645      * Method to do deletes. This method is to be used during a transaction,
646      * otherwise use the doDelete(Criteria) method. It will take care of
647      * the connection details internally.
648      *
649      * @param criteria object containing data that is used DELETE from database.
650      * @param con the connection to use
651      * @throws TorqueException Any exceptions caught during processing will be
652      * rethrown wrapped into a TorqueException.
653      */

654      public static void doDelete(Criteria criteria, Connection JavaDoc con)
655         throws TorqueException
656      {
657                                                                                                                                                                                                                                             
658         setDbName(criteria);
659
660         if (con == null)
661         {
662             BasePeer.doDelete(criteria);
663         }
664         else
665         {
666             BasePeer.doDelete(criteria, con);
667         }
668      }
669
670     /**
671      * Method to do selects
672      *
673      * @throws TorqueException Any exceptions caught during processing will be
674      * rethrown wrapped into a TorqueException.
675      */

676     public static List JavaDoc doSelect(Customer obj) throws TorqueException
677     {
678         return doSelect(buildSelectCriteria(obj));
679     }
680
681     /**
682      * Method to do inserts
683      *
684      * @throws TorqueException Any exceptions caught during processing will be
685      * rethrown wrapped into a TorqueException.
686      */

687     public static void doInsert(Customer obj) throws TorqueException
688     {
689           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
690           obj.setNew(false);
691         obj.setModified(false);
692     }
693
694     /**
695      * @param obj the data object to update in the database.
696      * @throws TorqueException Any exceptions caught during processing will be
697      * rethrown wrapped into a TorqueException.
698      */

699     public static void doUpdate(Customer obj) throws TorqueException
700     {
701         doUpdate(buildCriteria(obj));
702         obj.setModified(false);
703     }
704
705     /**
706      * @param obj the data object to delete in the database.
707      * @throws TorqueException Any exceptions caught during processing will be
708      * rethrown wrapped into a TorqueException.
709      */

710     public static void doDelete(Customer obj) throws TorqueException
711     {
712         doDelete(buildSelectCriteria(obj));
713     }
714
715     /**
716      * Method to do inserts. This method is to be used during a transaction,
717      * otherwise use the doInsert(Customer) method. It will take
718      * care of the connection details internally.
719      *
720      * @param obj the data object to insert into the database.
721      * @param con the connection to use
722      * @throws TorqueException Any exceptions caught during processing will be
723      * rethrown wrapped into a TorqueException.
724      */

725     public static void doInsert(Customer obj, Connection JavaDoc con)
726         throws TorqueException
727     {
728           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
729           obj.setNew(false);
730         obj.setModified(false);
731     }
732
733     /**
734      * Method to do update. This method is to be used during a transaction,
735      * otherwise use the doUpdate(Customer) method. It will take
736      * care of the connection details internally.
737      *
738      * @param obj the data object to update in the database.
739      * @param con the connection to use
740      * @throws TorqueException Any exceptions caught during processing will be
741      * rethrown wrapped into a TorqueException.
742      */

743     public static void doUpdate(Customer obj, Connection JavaDoc con)
744         throws TorqueException
745     {
746         doUpdate(buildCriteria(obj), con);
747         obj.setModified(false);
748     }
749
750     /**
751      * Method to delete. This method is to be used during a transaction,
752      * otherwise use the doDelete(Customer) method. It will take
753      * care of the connection details internally.
754      *
755      * @param obj the data object to delete in the database.
756      * @param con the connection to use
757      * @throws TorqueException Any exceptions caught during processing will be
758      * rethrown wrapped into a TorqueException.
759      */

760     public static void doDelete(Customer obj, Connection JavaDoc con)
761         throws TorqueException
762     {
763         doDelete(buildSelectCriteria(obj), con);
764     }
765
766     /**
767      * Method to do deletes.
768      *
769      * @param pk ObjectKey that is used DELETE from database.
770      * @throws TorqueException Any exceptions caught during processing will be
771      * rethrown wrapped into a TorqueException.
772      */

773     public static void doDelete(ObjectKey pk) throws TorqueException
774     {
775         BaseCustomerPeer
776            .doDelete(pk, (Connection JavaDoc) null);
777     }
778
779     /**
780      * Method to delete. This method is to be used during a transaction,
781      * otherwise use the doDelete(ObjectKey) method. It will take
782      * care of the connection details internally.
783      *
784      * @param pk the primary key for the object to delete in the database.
785      * @param con the connection to use
786      * @throws TorqueException Any exceptions caught during processing will be
787      * rethrown wrapped into a TorqueException.
788      */

789     public static void doDelete(ObjectKey pk, Connection JavaDoc con)
790         throws TorqueException
791     {
792         doDelete(buildCriteria(pk), con);
793     }
794
795     /** Build a Criteria object from an ObjectKey */
796     public static Criteria buildCriteria( ObjectKey pk )
797     {
798         Criteria criteria = new Criteria();
799               criteria.add(CUSTOMER_ID, pk);
800           return criteria;
801      }
802
803     /** Build a Criteria object from the data object for this peer */
804     public static Criteria buildCriteria( Customer obj )
805     {
806         Criteria criteria = new Criteria(DATABASE_NAME);
807               if (!obj.isNew())
808             criteria.add(CUSTOMER_ID, obj.getCustomerId());
809               criteria.add(CUSTOMER_CODE, obj.getCustomerCode());
810               criteria.add(STATUS, obj.getStatus());
811               criteria.add(PRIORITY, obj.getPriority());
812               criteria.add(CUSTOMER_TYPE, obj.getCustomerType());
813               criteria.add(CUSTOMER_CAT_ID, obj.getCustomerCatId());
814               criteria.add(CUSTOMER_NAME_1, obj.getCustomerName1());
815               criteria.add(CUSTOMER_NAME_2, obj.getCustomerName2());
816               criteria.add(CUSTOMER_DISPLAY, obj.getCustomerDisplay());
817               criteria.add(DEAR, obj.getDear());
818               criteria.add(ADDRESS_1, obj.getAddress1());
819               criteria.add(ADDRESS_2, obj.getAddress2());
820               criteria.add(CITY, obj.getCity());
821               criteria.add(ZIP, obj.getZip());
822               criteria.add(STATE, obj.getState());
823               criteria.add(COUNTRY_ID, obj.getCountryId());
824               criteria.add(REGION_ID, obj.getRegionId());
825               criteria.add(PHONE_1, obj.getPhone1());
826               criteria.add(PHONE_2, obj.getPhone2());
827               criteria.add(FAX, obj.getFax());
828               criteria.add(EMAIL, obj.getEmail());
829               criteria.add(EMAIL_FORMAT, obj.getEmailFormat());
830               criteria.add(SEND_NEWS, obj.getSendNews());
831               criteria.add(WEB_URL, obj.getWebUrl());
832               criteria.add(LANGUAGE_ID, obj.getLanguageId());
833               criteria.add(GENDER, obj.getGender());
834               criteria.add(EDUCATION_CAT_ID, obj.getEducationCatId());
835               criteria.add(HOUSEHOLD_CAT_ID, obj.getHouseholdCatId());
836               criteria.add(CUSTOM_1, obj.getCustom1());
837               criteria.add(CUSTOM_2, obj.getCustom2());
838               criteria.add(CUSTOM_3, obj.getCustom3());
839               criteria.add(CUSTOM_4, obj.getCustom4());
840               criteria.add(CUSTOM_5, obj.getCustom5());
841               criteria.add(CUSTOM_6, obj.getCustom6());
842               criteria.add(NOTES, obj.getNotes());
843               criteria.add(CREATED, obj.getCreated());
844               criteria.add(MODIFIED, obj.getModified());
845               criteria.add(CREATED_BY, obj.getCreatedBy());
846               criteria.add(MODIFIED_BY, obj.getModifiedBy());
847           return criteria;
848     }
849
850     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
851     public static Criteria buildSelectCriteria( Customer obj )
852     {
853         Criteria criteria = new Criteria(DATABASE_NAME);
854               if (!obj.isNew())
855                     criteria.add(CUSTOMER_ID, obj.getCustomerId());
856                           criteria.add(CUSTOMER_CODE, obj.getCustomerCode());
857                           criteria.add(STATUS, obj.getStatus());
858                           criteria.add(PRIORITY, obj.getPriority());
859                           criteria.add(CUSTOMER_TYPE, obj.getCustomerType());
860                           criteria.add(CUSTOMER_CAT_ID, obj.getCustomerCatId());
861                           criteria.add(CUSTOMER_NAME_1, obj.getCustomerName1());
862                           criteria.add(CUSTOMER_NAME_2, obj.getCustomerName2());
863                           criteria.add(CUSTOMER_DISPLAY, obj.getCustomerDisplay());
864                           criteria.add(DEAR, obj.getDear());
865                           criteria.add(ADDRESS_1, obj.getAddress1());
866                           criteria.add(ADDRESS_2, obj.getAddress2());
867                           criteria.add(CITY, obj.getCity());
868                           criteria.add(ZIP, obj.getZip());
869                           criteria.add(STATE, obj.getState());
870                           criteria.add(COUNTRY_ID, obj.getCountryId());
871                           criteria.add(REGION_ID, obj.getRegionId());
872                           criteria.add(PHONE_1, obj.getPhone1());
873                           criteria.add(PHONE_2, obj.getPhone2());
874                           criteria.add(FAX, obj.getFax());
875                           criteria.add(EMAIL, obj.getEmail());
876                           criteria.add(EMAIL_FORMAT, obj.getEmailFormat());
877                           criteria.add(SEND_NEWS, obj.getSendNews());
878                           criteria.add(WEB_URL, obj.getWebUrl());
879                           criteria.add(LANGUAGE_ID, obj.getLanguageId());
880                           criteria.add(GENDER, obj.getGender());
881                           criteria.add(EDUCATION_CAT_ID, obj.getEducationCatId());
882                           criteria.add(HOUSEHOLD_CAT_ID, obj.getHouseholdCatId());
883                           criteria.add(CUSTOM_1, obj.getCustom1());
884                           criteria.add(CUSTOM_2, obj.getCustom2());
885                           criteria.add(CUSTOM_3, obj.getCustom3());
886                           criteria.add(CUSTOM_4, obj.getCustom4());
887                           criteria.add(CUSTOM_5, obj.getCustom5());
888                           criteria.add(CUSTOM_6, obj.getCustom6());
889                           criteria.add(NOTES, obj.getNotes());
890                           criteria.add(CREATED, obj.getCreated());
891                           criteria.add(MODIFIED, obj.getModified());
892                           criteria.add(CREATED_BY, obj.getCreatedBy());
893                           criteria.add(MODIFIED_BY, obj.getModifiedBy());
894               return criteria;
895     }
896  
897     
898         /**
899      * Retrieve a single object by pk
900      *
901      * @param pk the primary key
902      * @throws TorqueException Any exceptions caught during processing will be
903      * rethrown wrapped into a TorqueException.
904      * @throws NoRowsException Primary key was not found in database.
905      * @throws TooManyRowsException Primary key was not found in database.
906      */

907     public static Customer retrieveByPK(int pk)
908         throws TorqueException, NoRowsException, TooManyRowsException
909     {
910         return retrieveByPK(SimpleKey.keyFor(pk));
911     }
912
913     /**
914      * Retrieve a single object by pk
915      *
916      * @param pk the primary key
917      * @param con the connection to use
918      * @throws TorqueException Any exceptions caught during processing will be
919      * rethrown wrapped into a TorqueException.
920      * @throws NoRowsException Primary key was not found in database.
921      * @throws TooManyRowsException Primary key was not found in database.
922      */

923     public static Customer retrieveByPK(int pk, Connection JavaDoc con)
924         throws TorqueException, NoRowsException, TooManyRowsException
925     {
926         return retrieveByPK(SimpleKey.keyFor(pk), con);
927     }
928   
929     /**
930      * Retrieve a single object by pk
931      *
932      * @param pk the primary key
933      * @throws TorqueException Any exceptions caught during processing will be
934      * rethrown wrapped into a TorqueException.
935      * @throws NoRowsException Primary key was not found in database.
936      * @throws TooManyRowsException Primary key was not found in database.
937      */

938     public static Customer retrieveByPK(ObjectKey pk)
939         throws TorqueException, NoRowsException, TooManyRowsException
940     {
941         Connection JavaDoc db = null;
942         Customer retVal = null;
943         try
944         {
945             db = Torque.getConnection(DATABASE_NAME);
946             retVal = retrieveByPK(pk, db);
947         }
948         finally
949         {
950             Torque.closeConnection(db);
951         }
952         return(retVal);
953     }
954
955     /**
956      * Retrieve a single object by pk
957      *
958      * @param pk the primary key
959      * @param con the connection to use
960      * @throws TorqueException Any exceptions caught during processing will be
961      * rethrown wrapped into a TorqueException.
962      * @throws NoRowsException Primary key was not found in database.
963      * @throws TooManyRowsException Primary key was not found in database.
964      */

965     public static Customer retrieveByPK(ObjectKey pk, Connection JavaDoc con)
966         throws TorqueException, NoRowsException, TooManyRowsException
967     {
968         Criteria criteria = buildCriteria(pk);
969         List JavaDoc v = doSelect(criteria, con);
970         if (v.size() == 0)
971         {
972             throw new NoRowsException("Failed to select a row.");
973         }
974         else if (v.size() > 1)
975         {
976             throw new TooManyRowsException("Failed to select only one row.");
977         }
978         else
979         {
980             return (Customer)v.get(0);
981         }
982     }
983
984     /**
985      * Retrieve a multiple objects by pk
986      *
987      * @param pks List of primary keys
988      * @throws TorqueException Any exceptions caught during processing will be
989      * rethrown wrapped into a TorqueException.
990      */

991     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
992         throws TorqueException
993     {
994         Connection JavaDoc db = null;
995         List JavaDoc retVal = null;
996         try
997         {
998            db = Torque.getConnection(DATABASE_NAME);
999            retVal = retrieveByPKs(pks, db);
1000        }
1001        finally
1002        {
1003            Torque.closeConnection(db);
1004        }
1005        return(retVal);
1006    }
1007
1008    /**
1009     * Retrieve a multiple objects by pk
1010     *
1011     * @param pks List of primary keys
1012     * @param dbcon the connection to use
1013     * @throws TorqueException Any exceptions caught during processing will be
1014     * rethrown wrapped into a TorqueException.
1015     */

1016    public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
1017        throws TorqueException
1018    {
1019        List JavaDoc objs = null;
1020        if (pks == null || pks.size() == 0)
1021        {
1022            objs = new LinkedList JavaDoc();
1023        }
1024        else
1025        {
1026            Criteria criteria = new Criteria();
1027              criteria.addIn( CUSTOMER_ID, pks );
1028          objs = doSelect(criteria, dbcon);
1029        }
1030        return objs;
1031    }
1032
1033 
1034
1035
1036
1037                    
1038                                              
1039                
1040                
1041
1042    /**
1043     * selects a collection of Customer objects pre-filled with their
1044     * CustomerCategory objects.
1045     *
1046     * This method is protected by default in order to keep the public
1047     * api reasonable. You can provide public methods for those you
1048     * actually need in CustomerPeer.
1049     *
1050     * @throws TorqueException Any exceptions caught during processing will be
1051     * rethrown wrapped into a TorqueException.
1052     */

1053    protected static List JavaDoc doSelectJoinCustomerCategory(Criteria criteria)
1054        throws TorqueException
1055    {
1056        setDbName(criteria);
1057
1058        CustomerPeer.addSelectColumns(criteria);
1059        int offset = numColumns + 1;
1060        CustomerCategoryPeer.addSelectColumns(criteria);
1061
1062
1063                        criteria.addJoin(CustomerPeer.CUSTOMER_CAT_ID,
1064            CustomerCategoryPeer.CUSTOMER_CAT_ID);
1065        
1066
1067                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
1068        List JavaDoc rows = BasePeer.doSelect(criteria);
1069        List JavaDoc results = new ArrayList JavaDoc();
1070
1071        for (int i = 0; i < rows.size(); i++)
1072        {
1073            Record row = (Record) rows.get(i);
1074
1075                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1076                    Customer obj1 = (Customer) CustomerPeer
1077                .row2Object(row, 1, omClass);
1078                     omClass = CustomerCategoryPeer.getOMClass();
1079                    CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
1080                .row2Object(row, offset, omClass);
1081
1082            boolean newObject = true;
1083            for (int j = 0; j < results.size(); j++)
1084            {
1085                Customer temp_obj1 = (Customer)results.get(j);
1086                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
1087                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1088                {
1089                    newObject = false;
1090                              temp_obj2.addCustomer(obj1);
1091                              break;
1092                }
1093            }
1094                      if (newObject)
1095            {
1096                obj2.initCustomers();
1097                obj2.addCustomer(obj1);
1098            }
1099                      results.add(obj1);
1100        }
1101        return results;
1102    }
1103                                                            
1104                
1105                
1106
1107    /**
1108     * selects a collection of Customer objects pre-filled with their
1109     * Country objects.
1110     *
1111     * This method is protected by default in order to keep the public
1112     * api reasonable. You can provide public methods for those you
1113     * actually need in CustomerPeer.
1114     *
1115     * @throws TorqueException Any exceptions caught during processing will be
1116     * rethrown wrapped into a TorqueException.
1117     */

1118    protected static List JavaDoc doSelectJoinCountry(Criteria criteria)
1119        throws TorqueException
1120    {
1121        setDbName(criteria);
1122
1123        CustomerPeer.addSelectColumns(criteria);
1124        int offset = numColumns + 1;
1125        CountryPeer.addSelectColumns(criteria);
1126
1127
1128                        criteria.addJoin(CustomerPeer.COUNTRY_ID,
1129            CountryPeer.COUNTRY_ID);
1130        
1131
1132                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
1133        List JavaDoc rows = BasePeer.doSelect(criteria);
1134        List JavaDoc results = new ArrayList JavaDoc();
1135
1136        for (int i = 0; i < rows.size(); i++)
1137        {
1138            Record row = (Record) rows.get(i);
1139
1140                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1141                    Customer obj1 = (Customer) CustomerPeer
1142                .row2Object(row, 1, omClass);
1143                     omClass = CountryPeer.getOMClass();
1144                    Country obj2 = (Country)CountryPeer
1145                .row2Object(row, offset, omClass);
1146
1147            boolean newObject = true;
1148            for (int j = 0; j < results.size(); j++)
1149            {
1150                Customer temp_obj1 = (Customer)results.get(j);
1151                Country temp_obj2 = (Country)temp_obj1.getCountry();
1152                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1153                {
1154                    newObject = false;
1155                              temp_obj2.addCustomer(obj1);
1156                              break;
1157                }
1158            }
1159                      if (newObject)
1160            {
1161                obj2.initCustomers();
1162                obj2.addCustomer(obj1);
1163            }
1164                      results.add(obj1);
1165        }
1166        return results;
1167    }
1168                                                            
1169                
1170                
1171
1172    /**
1173     * selects a collection of Customer objects pre-filled with their
1174     * Region objects.
1175     *
1176     * This method is protected by default in order to keep the public
1177     * api reasonable. You can provide public methods for those you
1178     * actually need in CustomerPeer.
1179     *
1180     * @throws TorqueException Any exceptions caught during processing will be
1181     * rethrown wrapped into a TorqueException.
1182     */

1183    protected static List JavaDoc doSelectJoinRegion(Criteria criteria)
1184        throws TorqueException
1185    {
1186        setDbName(criteria);
1187
1188        CustomerPeer.addSelectColumns(criteria);
1189        int offset = numColumns + 1;
1190        RegionPeer.addSelectColumns(criteria);
1191
1192
1193                        criteria.addJoin(CustomerPeer.REGION_ID,
1194            RegionPeer.REGION_ID);
1195        
1196
1197                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
1198        List JavaDoc rows = BasePeer.doSelect(criteria);
1199        List JavaDoc results = new ArrayList JavaDoc();
1200
1201        for (int i = 0; i < rows.size(); i++)
1202        {
1203            Record row = (Record) rows.get(i);
1204
1205                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1206                    Customer obj1 = (Customer) CustomerPeer
1207                .row2Object(row, 1, omClass);
1208                     omClass = RegionPeer.getOMClass();
1209                    Region obj2 = (Region)RegionPeer
1210                .row2Object(row, offset, omClass);
1211
1212            boolean newObject = true;
1213            for (int j = 0; j < results.size(); j++)
1214            {
1215                Customer temp_obj1 = (Customer)results.get(j);
1216                Region temp_obj2 = (Region)temp_obj1.getRegion();
1217                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1218                {
1219                    newObject = false;
1220                              temp_obj2.addCustomer(obj1);
1221                              break;
1222                }
1223            }
1224                      if (newObject)
1225            {
1226                obj2.initCustomers();
1227                obj2.addCustomer(obj1);
1228            }
1229                      results.add(obj1);
1230        }
1231        return results;
1232    }
1233                                                            
1234                
1235                
1236
1237    /**
1238     * selects a collection of Customer objects pre-filled with their
1239     * Language objects.
1240     *
1241     * This method is protected by default in order to keep the public
1242     * api reasonable. You can provide public methods for those you
1243     * actually need in CustomerPeer.
1244     *
1245     * @throws TorqueException Any exceptions caught during processing will be
1246     * rethrown wrapped into a TorqueException.
1247     */

1248    protected static List JavaDoc doSelectJoinLanguage(Criteria criteria)
1249        throws TorqueException
1250    {
1251        setDbName(criteria);
1252
1253        CustomerPeer.addSelectColumns(criteria);
1254        int offset = numColumns + 1;
1255        LanguagePeer.addSelectColumns(criteria);
1256
1257
1258                        criteria.addJoin(CustomerPeer.LANGUAGE_ID,
1259            LanguagePeer.LANGUAGE_ID);
1260        
1261
1262                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
1263        List JavaDoc rows = BasePeer.doSelect(criteria);
1264        List JavaDoc results = new ArrayList JavaDoc();
1265
1266        for (int i = 0; i < rows.size(); i++)
1267        {
1268            Record row = (Record) rows.get(i);
1269
1270                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1271                    Customer obj1 = (Customer) CustomerPeer
1272                .row2Object(row, 1, omClass);
1273                     omClass = LanguagePeer.getOMClass();
1274                    Language obj2 = (Language)LanguagePeer
1275                .row2Object(row, offset, omClass);
1276
1277            boolean newObject = true;
1278            for (int j = 0; j < results.size(); j++)
1279            {
1280                Customer temp_obj1 = (Customer)results.get(j);
1281                Language temp_obj2 = (Language)temp_obj1.getLanguage();
1282                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1283                {
1284                    newObject = false;
1285                              temp_obj2.addCustomer(obj1);
1286                              break;
1287                }
1288            }
1289                      if (newObject)
1290            {
1291                obj2.initCustomers();
1292                obj2.addCustomer(obj1);
1293            }
1294                      results.add(obj1);
1295        }
1296        return results;
1297    }
1298                                                            
1299                
1300                
1301
1302    /**
1303     * selects a collection of Customer objects pre-filled with their
1304     * EducationCategory objects.
1305     *
1306     * This method is protected by default in order to keep the public
1307     * api reasonable. You can provide public methods for those you
1308     * actually need in CustomerPeer.
1309     *
1310     * @throws TorqueException Any exceptions caught during processing will be
1311     * rethrown wrapped into a TorqueException.
1312     */

1313    protected static List JavaDoc doSelectJoinEducationCategory(Criteria criteria)
1314        throws TorqueException
1315    {
1316        setDbName(criteria);
1317
1318        CustomerPeer.addSelectColumns(criteria);
1319        int offset = numColumns + 1;
1320        EducationCategoryPeer.addSelectColumns(criteria);
1321
1322
1323                        criteria.addJoin(CustomerPeer.EDUCATION_CAT_ID,
1324            EducationCategoryPeer.EDUCATION_CAT_ID);
1325        
1326
1327                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
1328        List JavaDoc rows = BasePeer.doSelect(criteria);
1329        List JavaDoc results = new ArrayList JavaDoc();
1330
1331        for (int i = 0; i < rows.size(); i++)
1332        {
1333            Record row = (Record) rows.get(i);
1334
1335                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1336                    Customer obj1 = (Customer) CustomerPeer
1337                .row2Object(row, 1, omClass);
1338                     omClass = EducationCategoryPeer.getOMClass();
1339                    EducationCategory obj2 = (EducationCategory)EducationCategoryPeer
1340                .row2Object(row, offset, omClass);
1341
1342            boolean newObject = true;
1343            for (int j = 0; j < results.size(); j++)
1344            {
1345                Customer temp_obj1 = (Customer)results.get(j);
1346                EducationCategory temp_obj2 = (EducationCategory)temp_obj1.getEducationCategory();
1347                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1348                {
1349                    newObject = false;
1350                              temp_obj2.addCustomer(obj1);
1351                              break;
1352                }
1353            }
1354                      if (newObject)
1355            {
1356                obj2.initCustomers();
1357                obj2.addCustomer(obj1);
1358            }
1359                      results.add(obj1);
1360        }
1361        return results;
1362    }
1363                                                            
1364                
1365                
1366
1367    /**
1368     * selects a collection of Customer objects pre-filled with their
1369     * HouseholdCategory objects.
1370     *
1371     * This method is protected by default in order to keep the public
1372     * api reasonable. You can provide public methods for those you
1373     * actually need in CustomerPeer.
1374     *
1375     * @throws TorqueException Any exceptions caught during processing will be
1376     * rethrown wrapped into a TorqueException.
1377     */

1378    protected static List JavaDoc doSelectJoinHouseholdCategory(Criteria criteria)
1379        throws TorqueException
1380    {
1381        setDbName(criteria);
1382
1383        CustomerPeer.addSelectColumns(criteria);
1384        int offset = numColumns + 1;
1385        HouseholdCategoryPeer.addSelectColumns(criteria);
1386
1387
1388                        criteria.addJoin(CustomerPeer.HOUSEHOLD_CAT_ID,
1389            HouseholdCategoryPeer.HOUSEHOLD_CAT_ID);
1390        
1391
1392                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
1393        List JavaDoc rows = BasePeer.doSelect(criteria);
1394        List JavaDoc results = new ArrayList JavaDoc();
1395
1396        for (int i = 0; i < rows.size(); i++)
1397        {
1398            Record row = (Record) rows.get(i);
1399
1400                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1401                    Customer obj1 = (Customer) CustomerPeer
1402                .row2Object(row, 1, omClass);
1403                     omClass = HouseholdCategoryPeer.getOMClass();
1404                    HouseholdCategory obj2 = (HouseholdCategory)HouseholdCategoryPeer
1405                .row2Object(row, offset, omClass);
1406
1407            boolean newObject = true;
1408            for (int j = 0; j < results.size(); j++)
1409            {
1410                Customer temp_obj1 = (Customer)results.get(j);
1411                HouseholdCategory temp_obj2 = (HouseholdCategory)temp_obj1.getHouseholdCategory();
1412                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1413                {
1414                    newObject = false;
1415                              temp_obj2.addCustomer(obj1);
1416                              break;
1417                }
1418            }
1419                      if (newObject)
1420            {
1421                obj2.initCustomers();
1422                obj2.addCustomer(obj1);
1423            }
1424                      results.add(obj1);
1425        }
1426        return results;
1427    }
1428                    
1429  
1430                                                                  
1431          
1432        
1433                                  
1434                
1435
1436    /**
1437     * selects a collection of Customer objects pre-filled with
1438     * all related objects.
1439     *
1440     * This method is protected by default in order to keep the public
1441     * api reasonable. You can provide public methods for those you
1442     * actually need in CustomerPeer.
1443     *
1444     * @throws TorqueException Any exceptions caught during processing will be
1445     * rethrown wrapped into a TorqueException.
1446     */

1447    protected static List JavaDoc doSelectJoinAllExceptCustomerCategory(Criteria criteria)
1448        throws TorqueException
1449    {
1450        setDbName(criteria);
1451
1452        addSelectColumns(criteria);
1453        int offset2 = numColumns + 1;
1454                                    
1455                                                  
1456                    CountryPeer.addSelectColumns(criteria);
1457        int offset3 = offset2 + CountryPeer.numColumns;
1458                                                                
1459                    RegionPeer.addSelectColumns(criteria);
1460        int offset4 = offset3 + RegionPeer.numColumns;
1461                                                                
1462                    LanguagePeer.addSelectColumns(criteria);
1463        int offset5 = offset4 + LanguagePeer.numColumns;
1464                                                                
1465                    EducationCategoryPeer.addSelectColumns(criteria);
1466        int offset6 = offset5 + EducationCategoryPeer.numColumns;
1467                                                                
1468                    HouseholdCategoryPeer.addSelectColumns(criteria);
1469        int offset7 = offset6 + HouseholdCategoryPeer.numColumns;
1470                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
1471        List JavaDoc rows = BasePeer.doSelect(criteria);
1472        List JavaDoc results = new ArrayList JavaDoc();
1473
1474        for (int i = 0; i < rows.size(); i++)
1475        {
1476            Record row = (Record)rows.get(i);
1477
1478                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1479                    Customer obj1 = (Customer)CustomerPeer
1480                .row2Object(row, 1, omClass);
1481                                                
1482                                                                  
1483                                                        
1484                            
1485              
1486                           omClass = CountryPeer.getOMClass();
1487                          Country obj2 = (Country)CountryPeer
1488                .row2Object( row, offset2, omClass);
1489
1490               boolean newObject = true;
1491            for (int j = 0; j < results.size(); j++)
1492            {
1493                Customer temp_obj1 = (Customer)results.get(j);
1494                Country temp_obj2 = (Country)temp_obj1.getCountry();
1495                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1496                {
1497                    newObject = false;
1498                                    temp_obj2.addCustomer(obj1);
1499                                    break;
1500                }
1501            }
1502                            if (newObject)
1503            {
1504                obj2.initCustomers();
1505                obj2.addCustomer(obj1);
1506            }
1507                                                                                    
1508                                                        
1509                            
1510              
1511                           omClass = RegionPeer.getOMClass();
1512                          Region obj3 = (Region)RegionPeer
1513                .row2Object( row, offset3, omClass);
1514
1515               newObject = true;
1516            for (int j = 0; j < results.size(); j++)
1517            {
1518                Customer temp_obj1 = (Customer)results.get(j);
1519                Region temp_obj3 = (Region)temp_obj1.getRegion();
1520                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1521                {
1522                    newObject = false;
1523                                    temp_obj3.addCustomer(obj1);
1524                                    break;
1525                }
1526            }
1527                            if (newObject)
1528            {
1529                obj3.initCustomers();
1530                obj3.addCustomer(obj1);
1531            }
1532                                                                                    
1533                                                        
1534                            
1535              
1536                           omClass = LanguagePeer.getOMClass();
1537                          Language obj4 = (Language)LanguagePeer
1538                .row2Object( row, offset4, omClass);
1539
1540               newObject = true;
1541            for (int j = 0; j < results.size(); j++)
1542            {
1543                Customer temp_obj1 = (Customer)results.get(j);
1544                Language temp_obj4 = (Language)temp_obj1.getLanguage();
1545                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1546                {
1547                    newObject = false;
1548                                    temp_obj4.addCustomer(obj1);
1549                                    break;
1550                }
1551            }
1552                            if (newObject)
1553            {
1554                obj4.initCustomers();
1555                obj4.addCustomer(obj1);
1556            }
1557                                                                                    
1558                                                        
1559                            
1560              
1561                           omClass = EducationCategoryPeer.getOMClass();
1562                          EducationCategory obj5 = (EducationCategory)EducationCategoryPeer
1563                .row2Object( row, offset5, omClass);
1564
1565               newObject = true;
1566            for (int j = 0; j < results.size(); j++)
1567            {
1568                Customer temp_obj1 = (Customer)results.get(j);
1569                EducationCategory temp_obj5 = (EducationCategory)temp_obj1.getEducationCategory();
1570                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1571                {
1572                    newObject = false;
1573                                    temp_obj5.addCustomer(obj1);
1574                                    break;
1575                }
1576            }
1577                            if (newObject)
1578            {
1579                obj5.initCustomers();
1580                obj5.addCustomer(obj1);
1581            }
1582                                                                                    
1583                                                        
1584                            
1585              
1586                           omClass = HouseholdCategoryPeer.getOMClass();
1587                          HouseholdCategory obj6 = (HouseholdCategory)HouseholdCategoryPeer
1588                .row2Object( row, offset6, omClass);
1589
1590               newObject = true;
1591            for (int j = 0; j < results.size(); j++)
1592            {
1593                Customer temp_obj1 = (Customer)results.get(j);
1594                HouseholdCategory temp_obj6 = (HouseholdCategory)temp_obj1.getHouseholdCategory();
1595                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1596                {
1597                    newObject = false;
1598                                    temp_obj6.addCustomer(obj1);
1599                                    break;
1600                }
1601            }
1602                            if (newObject)
1603            {
1604                obj6.initCustomers();
1605                obj6.addCustomer(obj1);
1606            }
1607                                                                results.add(obj1);
1608        }
1609        return results;
1610    }
1611        
1612        
1613                                  
1614                
1615
1616    /**
1617     * selects a collection of Customer objects pre-filled with
1618     * all related objects.
1619     *
1620     * This method is protected by default in order to keep the public
1621     * api reasonable. You can provide public methods for those you
1622     * actually need in CustomerPeer.
1623     *
1624     * @throws TorqueException Any exceptions caught during processing will be
1625     * rethrown wrapped into a TorqueException.
1626     */

1627    protected static List JavaDoc doSelectJoinAllExceptCountry(Criteria criteria)
1628        throws TorqueException
1629    {
1630        setDbName(criteria);
1631
1632        addSelectColumns(criteria);
1633        int offset2 = numColumns + 1;
1634                                    
1635                    CustomerCategoryPeer.addSelectColumns(criteria);
1636        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
1637                                                                
1638                                                  
1639                    RegionPeer.addSelectColumns(criteria);
1640        int offset4 = offset3 + RegionPeer.numColumns;
1641                                                                
1642                    LanguagePeer.addSelectColumns(criteria);
1643        int offset5 = offset4 + LanguagePeer.numColumns;
1644                                                                
1645                    EducationCategoryPeer.addSelectColumns(criteria);
1646        int offset6 = offset5 + EducationCategoryPeer.numColumns;
1647                                                                
1648                    HouseholdCategoryPeer.addSelectColumns(criteria);
1649        int offset7 = offset6 + HouseholdCategoryPeer.numColumns;
1650                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
1651        List JavaDoc rows = BasePeer.doSelect(criteria);
1652        List JavaDoc results = new ArrayList JavaDoc();
1653
1654        for (int i = 0; i < rows.size(); i++)
1655        {
1656            Record row = (Record)rows.get(i);
1657
1658                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1659                    Customer obj1 = (Customer)CustomerPeer
1660                .row2Object(row, 1, omClass);
1661                                                
1662                                                        
1663                            
1664              
1665                           omClass = CustomerCategoryPeer.getOMClass();
1666                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
1667                .row2Object( row, offset2, omClass);
1668
1669               boolean newObject = true;
1670            for (int j = 0; j < results.size(); j++)
1671            {
1672                Customer temp_obj1 = (Customer)results.get(j);
1673                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
1674                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1675                {
1676                    newObject = false;
1677                                    temp_obj2.addCustomer(obj1);
1678                                    break;
1679                }
1680            }
1681                            if (newObject)
1682            {
1683                obj2.initCustomers();
1684                obj2.addCustomer(obj1);
1685            }
1686                                                                                    
1687                                                                  
1688                                                        
1689                            
1690              
1691                           omClass = RegionPeer.getOMClass();
1692                          Region obj3 = (Region)RegionPeer
1693                .row2Object( row, offset3, omClass);
1694
1695               newObject = true;
1696            for (int j = 0; j < results.size(); j++)
1697            {
1698                Customer temp_obj1 = (Customer)results.get(j);
1699                Region temp_obj3 = (Region)temp_obj1.getRegion();
1700                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1701                {
1702                    newObject = false;
1703                                    temp_obj3.addCustomer(obj1);
1704                                    break;
1705                }
1706            }
1707                            if (newObject)
1708            {
1709                obj3.initCustomers();
1710                obj3.addCustomer(obj1);
1711            }
1712                                                                                    
1713                                                        
1714                            
1715              
1716                           omClass = LanguagePeer.getOMClass();
1717                          Language obj4 = (Language)LanguagePeer
1718                .row2Object( row, offset4, omClass);
1719
1720               newObject = true;
1721            for (int j = 0; j < results.size(); j++)
1722            {
1723                Customer temp_obj1 = (Customer)results.get(j);
1724                Language temp_obj4 = (Language)temp_obj1.getLanguage();
1725                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1726                {
1727                    newObject = false;
1728                                    temp_obj4.addCustomer(obj1);
1729                                    break;
1730                }
1731            }
1732                            if (newObject)
1733            {
1734                obj4.initCustomers();
1735                obj4.addCustomer(obj1);
1736            }
1737                                                                                    
1738                                                        
1739                            
1740              
1741                           omClass = EducationCategoryPeer.getOMClass();
1742                          EducationCategory obj5 = (EducationCategory)EducationCategoryPeer
1743                .row2Object( row, offset5, omClass);
1744
1745               newObject = true;
1746            for (int j = 0; j < results.size(); j++)
1747            {
1748                Customer temp_obj1 = (Customer)results.get(j);
1749                EducationCategory temp_obj5 = (EducationCategory)temp_obj1.getEducationCategory();
1750                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1751                {
1752                    newObject = false;
1753                                    temp_obj5.addCustomer(obj1);
1754                                    break;
1755                }
1756            }
1757                            if (newObject)
1758            {
1759                obj5.initCustomers();
1760                obj5.addCustomer(obj1);
1761            }
1762                                                                                    
1763                                                        
1764                            
1765              
1766                           omClass = HouseholdCategoryPeer.getOMClass();
1767                          HouseholdCategory obj6 = (HouseholdCategory)HouseholdCategoryPeer
1768                .row2Object( row, offset6, omClass);
1769
1770               newObject = true;
1771            for (int j = 0; j < results.size(); j++)
1772            {
1773                Customer temp_obj1 = (Customer)results.get(j);
1774                HouseholdCategory temp_obj6 = (HouseholdCategory)temp_obj1.getHouseholdCategory();
1775                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1776                {
1777                    newObject = false;
1778                                    temp_obj6.addCustomer(obj1);
1779                                    break;
1780                }
1781            }
1782                            if (newObject)
1783            {
1784                obj6.initCustomers();
1785                obj6.addCustomer(obj1);
1786            }
1787                                                                results.add(obj1);
1788        }
1789        return results;
1790    }
1791        
1792        
1793                                  
1794                
1795
1796    /**
1797     * selects a collection of Customer objects pre-filled with
1798     * all related objects.
1799     *
1800     * This method is protected by default in order to keep the public
1801     * api reasonable. You can provide public methods for those you
1802     * actually need in CustomerPeer.
1803     *
1804     * @throws TorqueException Any exceptions caught during processing will be
1805     * rethrown wrapped into a TorqueException.
1806     */

1807    protected static List JavaDoc doSelectJoinAllExceptRegion(Criteria criteria)
1808        throws TorqueException
1809    {
1810        setDbName(criteria);
1811
1812        addSelectColumns(criteria);
1813        int offset2 = numColumns + 1;
1814                                    
1815                    CustomerCategoryPeer.addSelectColumns(criteria);
1816        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
1817                                                                
1818                    CountryPeer.addSelectColumns(criteria);
1819        int offset4 = offset3 + CountryPeer.numColumns;
1820                                                                
1821                                                  
1822                    LanguagePeer.addSelectColumns(criteria);
1823        int offset5 = offset4 + LanguagePeer.numColumns;
1824                                                                
1825                    EducationCategoryPeer.addSelectColumns(criteria);
1826        int offset6 = offset5 + EducationCategoryPeer.numColumns;
1827                                                                
1828                    HouseholdCategoryPeer.addSelectColumns(criteria);
1829        int offset7 = offset6 + HouseholdCategoryPeer.numColumns;
1830                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
1831        List JavaDoc rows = BasePeer.doSelect(criteria);
1832        List JavaDoc results = new ArrayList JavaDoc();
1833
1834        for (int i = 0; i < rows.size(); i++)
1835        {
1836            Record row = (Record)rows.get(i);
1837
1838                            Class JavaDoc omClass = CustomerPeer.getOMClass();
1839                    Customer obj1 = (Customer)CustomerPeer
1840                .row2Object(row, 1, omClass);
1841                                                
1842                                                        
1843                            
1844              
1845                           omClass = CustomerCategoryPeer.getOMClass();
1846                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
1847                .row2Object( row, offset2, omClass);
1848
1849               boolean newObject = true;
1850            for (int j = 0; j < results.size(); j++)
1851            {
1852                Customer temp_obj1 = (Customer)results.get(j);
1853                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
1854                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1855                {
1856                    newObject = false;
1857                                    temp_obj2.addCustomer(obj1);
1858                                    break;
1859                }
1860            }
1861                            if (newObject)
1862            {
1863                obj2.initCustomers();
1864                obj2.addCustomer(obj1);
1865            }
1866                                                                                    
1867                                                        
1868                            
1869              
1870                           omClass = CountryPeer.getOMClass();
1871                          Country obj3 = (Country)CountryPeer
1872                .row2Object( row, offset3, omClass);
1873
1874               newObject = true;
1875            for (int j = 0; j < results.size(); j++)
1876            {
1877                Customer temp_obj1 = (Customer)results.get(j);
1878                Country temp_obj3 = (Country)temp_obj1.getCountry();
1879                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1880                {
1881                    newObject = false;
1882                                    temp_obj3.addCustomer(obj1);
1883                                    break;
1884                }
1885            }
1886                            if (newObject)
1887            {
1888                obj3.initCustomers();
1889                obj3.addCustomer(obj1);
1890            }
1891                                                                                    
1892                                                                  
1893                                                        
1894                            
1895              
1896                           omClass = LanguagePeer.getOMClass();
1897                          Language obj4 = (Language)LanguagePeer
1898                .row2Object( row, offset4, omClass);
1899
1900               newObject = true;
1901            for (int j = 0; j < results.size(); j++)
1902            {
1903                Customer temp_obj1 = (Customer)results.get(j);
1904                Language temp_obj4 = (Language)temp_obj1.getLanguage();
1905                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1906                {
1907                    newObject = false;
1908                                    temp_obj4.addCustomer(obj1);
1909                                    break;
1910                }
1911            }
1912                            if (newObject)
1913            {
1914                obj4.initCustomers();
1915                obj4.addCustomer(obj1);
1916            }
1917                                                                                    
1918                                                        
1919                            
1920              
1921                           omClass = EducationCategoryPeer.getOMClass();
1922                          EducationCategory obj5 = (EducationCategory)EducationCategoryPeer
1923                .row2Object( row, offset5, omClass);
1924
1925               newObject = true;
1926            for (int j = 0; j < results.size(); j++)
1927            {
1928                Customer temp_obj1 = (Customer)results.get(j);
1929                EducationCategory temp_obj5 = (EducationCategory)temp_obj1.getEducationCategory();
1930                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1931                {
1932                    newObject = false;
1933                                    temp_obj5.addCustomer(obj1);
1934                                    break;
1935                }
1936            }
1937                            if (newObject)
1938            {
1939                obj5.initCustomers();
1940                obj5.addCustomer(obj1);
1941            }
1942                                                                                    
1943                                                        
1944                            
1945              
1946                           omClass = HouseholdCategoryPeer.getOMClass();
1947                          HouseholdCategory obj6 = (HouseholdCategory)HouseholdCategoryPeer
1948                .row2Object( row, offset6, omClass);
1949
1950               newObject = true;
1951            for (int j = 0; j < results.size(); j++)
1952            {
1953                Customer temp_obj1 = (Customer)results.get(j);
1954                HouseholdCategory temp_obj6 = (HouseholdCategory)temp_obj1.getHouseholdCategory();
1955                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1956                {
1957                    newObject = false;
1958                                    temp_obj6.addCustomer(obj1);
1959                                    break;
1960                }
1961            }
1962                            if (newObject)
1963            {
1964                obj6.initCustomers();
1965                obj6.addCustomer(obj1);
1966            }
1967                                                                results.add(obj1);
1968        }
1969        return results;
1970    }
1971        
1972        
1973                                  
1974                
1975
1976    /**
1977     * selects a collection of Customer objects pre-filled with
1978     * all related objects.
1979     *
1980     * This method is protected by default in order to keep the public
1981     * api reasonable. You can provide public methods for those you
1982     * actually need in CustomerPeer.
1983     *
1984     * @throws TorqueException Any exceptions caught during processing will be
1985     * rethrown wrapped into a TorqueException.
1986     */

1987    protected static List JavaDoc doSelectJoinAllExceptLanguage(Criteria criteria)
1988        throws TorqueException
1989    {
1990        setDbName(criteria);
1991
1992        addSelectColumns(criteria);
1993        int offset2 = numColumns + 1;
1994                                    
1995                    CustomerCategoryPeer.addSelectColumns(criteria);
1996        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
1997                                                                
1998                    CountryPeer.addSelectColumns(criteria);
1999        int offset4 = offset3 + CountryPeer.numColumns;
2000                                                                
2001                    RegionPeer.addSelectColumns(criteria);
2002        int offset5 = offset4 + RegionPeer.numColumns;
2003                                                                
2004                                                  
2005                    EducationCategoryPeer.addSelectColumns(criteria);
2006        int offset6 = offset5 + EducationCategoryPeer.numColumns;
2007                                                                
2008                    HouseholdCategoryPeer.addSelectColumns(criteria);
2009        int offset7 = offset6 + HouseholdCategoryPeer.numColumns;
2010                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
2011        List JavaDoc rows = BasePeer.doSelect(criteria);
2012        List JavaDoc results = new ArrayList JavaDoc();
2013
2014        for (int i = 0; i < rows.size(); i++)
2015        {
2016            Record row = (Record)rows.get(i);
2017
2018                            Class JavaDoc omClass = CustomerPeer.getOMClass();
2019                    Customer obj1 = (Customer)CustomerPeer
2020                .row2Object(row, 1, omClass);
2021                                                
2022                                                        
2023                            
2024              
2025                           omClass = CustomerCategoryPeer.getOMClass();
2026                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
2027                .row2Object( row, offset2, omClass);
2028
2029               boolean newObject = true;
2030            for (int j = 0; j < results.size(); j++)
2031            {
2032                Customer temp_obj1 = (Customer)results.get(j);
2033                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
2034                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2035                {
2036                    newObject = false;
2037                                    temp_obj2.addCustomer(obj1);
2038                                    break;
2039                }
2040            }
2041                            if (newObject)
2042            {
2043                obj2.initCustomers();
2044                obj2.addCustomer(obj1);
2045            }
2046                                                                                    
2047                                                        
2048                            
2049              
2050                           omClass = CountryPeer.getOMClass();
2051                          Country obj3 = (Country)CountryPeer
2052                .row2Object( row, offset3, omClass);
2053
2054               newObject = true;
2055            for (int j = 0; j < results.size(); j++)
2056            {
2057                Customer temp_obj1 = (Customer)results.get(j);
2058                Country temp_obj3 = (Country)temp_obj1.getCountry();
2059                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2060                {
2061                    newObject = false;
2062                                    temp_obj3.addCustomer(obj1);
2063                                    break;
2064                }
2065            }
2066                            if (newObject)
2067            {
2068                obj3.initCustomers();
2069                obj3.addCustomer(obj1);
2070            }
2071                                                                                    
2072                                                        
2073                            
2074              
2075                           omClass = RegionPeer.getOMClass();
2076                          Region obj4 = (Region)RegionPeer
2077                .row2Object( row, offset4, omClass);
2078
2079               newObject = true;
2080            for (int j = 0; j < results.size(); j++)
2081            {
2082                Customer temp_obj1 = (Customer)results.get(j);
2083                Region temp_obj4 = (Region)temp_obj1.getRegion();
2084                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2085                {
2086                    newObject = false;
2087                                    temp_obj4.addCustomer(obj1);
2088                                    break;
2089                }
2090            }
2091                            if (newObject)
2092            {
2093                obj4.initCustomers();
2094                obj4.addCustomer(obj1);
2095            }
2096                                                                                    
2097                                                                  
2098                                                        
2099                            
2100              
2101                           omClass = EducationCategoryPeer.getOMClass();
2102                          EducationCategory obj5 = (EducationCategory)EducationCategoryPeer
2103                .row2Object( row, offset5, omClass);
2104
2105               newObject = true;
2106            for (int j = 0; j < results.size(); j++)
2107            {
2108                Customer temp_obj1 = (Customer)results.get(j);
2109                EducationCategory temp_obj5 = (EducationCategory)temp_obj1.getEducationCategory();
2110                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2111                {
2112                    newObject = false;
2113                                    temp_obj5.addCustomer(obj1);
2114                                    break;
2115                }
2116            }
2117                            if (newObject)
2118            {
2119                obj5.initCustomers();
2120                obj5.addCustomer(obj1);
2121            }
2122                                                                                    
2123                                                        
2124                            
2125              
2126                           omClass = HouseholdCategoryPeer.getOMClass();
2127                          HouseholdCategory obj6 = (HouseholdCategory)HouseholdCategoryPeer
2128                .row2Object( row, offset6, omClass);
2129
2130               newObject = true;
2131            for (int j = 0; j < results.size(); j++)
2132            {
2133                Customer temp_obj1 = (Customer)results.get(j);
2134                HouseholdCategory temp_obj6 = (HouseholdCategory)temp_obj1.getHouseholdCategory();
2135                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2136                {
2137                    newObject = false;
2138                                    temp_obj6.addCustomer(obj1);
2139                                    break;
2140                }
2141            }
2142                            if (newObject)
2143            {
2144                obj6.initCustomers();
2145                obj6.addCustomer(obj1);
2146            }
2147                                                                results.add(obj1);
2148        }
2149        return results;
2150    }
2151        
2152        
2153                                  
2154                
2155
2156    /**
2157     * selects a collection of Customer objects pre-filled with
2158     * all related objects.
2159     *
2160     * This method is protected by default in order to keep the public
2161     * api reasonable. You can provide public methods for those you
2162     * actually need in CustomerPeer.
2163     *
2164     * @throws TorqueException Any exceptions caught during processing will be
2165     * rethrown wrapped into a TorqueException.
2166     */

2167    protected static List JavaDoc doSelectJoinAllExceptEducationCategory(Criteria criteria)
2168        throws TorqueException
2169    {
2170        setDbName(criteria);
2171
2172        addSelectColumns(criteria);
2173        int offset2 = numColumns + 1;
2174                                    
2175                    CustomerCategoryPeer.addSelectColumns(criteria);
2176        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
2177                                                                
2178                    CountryPeer.addSelectColumns(criteria);
2179        int offset4 = offset3 + CountryPeer.numColumns;
2180                                                                
2181                    RegionPeer.addSelectColumns(criteria);
2182        int offset5 = offset4 + RegionPeer.numColumns;
2183                                                                
2184                    LanguagePeer.addSelectColumns(criteria);
2185        int offset6 = offset5 + LanguagePeer.numColumns;
2186                                                                
2187                                                  
2188                    HouseholdCategoryPeer.addSelectColumns(criteria);
2189        int offset7 = offset6 + HouseholdCategoryPeer.numColumns;
2190                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
2191        List JavaDoc rows = BasePeer.doSelect(criteria);
2192        List JavaDoc results = new ArrayList JavaDoc();
2193
2194        for (int i = 0; i < rows.size(); i++)
2195        {
2196            Record row = (Record)rows.get(i);
2197
2198                            Class JavaDoc omClass = CustomerPeer.getOMClass();
2199                    Customer obj1 = (Customer)CustomerPeer
2200                .row2Object(row, 1, omClass);
2201                                                
2202                                                        
2203                            
2204              
2205                           omClass = CustomerCategoryPeer.getOMClass();
2206                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
2207                .row2Object( row, offset2, omClass);
2208
2209               boolean newObject = true;
2210            for (int j = 0; j < results.size(); j++)
2211            {
2212                Customer temp_obj1 = (Customer)results.get(j);
2213                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
2214                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2215                {
2216                    newObject = false;
2217                                    temp_obj2.addCustomer(obj1);
2218                                    break;
2219                }
2220            }
2221                            if (newObject)
2222            {
2223                obj2.initCustomers();
2224                obj2.addCustomer(obj1);
2225            }
2226                                                                                    
2227                                                        
2228                            
2229              
2230                           omClass = CountryPeer.getOMClass();
2231                          Country obj3 = (Country)CountryPeer
2232                .row2Object( row, offset3, omClass);
2233
2234               newObject = true;
2235            for (int j = 0; j < results.size(); j++)
2236            {
2237                Customer temp_obj1 = (Customer)results.get(j);
2238                Country temp_obj3 = (Country)temp_obj1.getCountry();
2239                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2240                {
2241                    newObject = false;
2242                                    temp_obj3.addCustomer(obj1);
2243                                    break;
2244                }
2245            }
2246                            if (newObject)
2247            {
2248                obj3.initCustomers();
2249                obj3.addCustomer(obj1);
2250            }
2251                                                                                    
2252                                                        
2253                            
2254              
2255                           omClass = RegionPeer.getOMClass();
2256                          Region obj4 = (Region)RegionPeer
2257                .row2Object( row, offset4, omClass);
2258
2259               newObject = true;
2260            for (int j = 0; j < results.size(); j++)
2261            {
2262                Customer temp_obj1 = (Customer)results.get(j);
2263                Region temp_obj4 = (Region)temp_obj1.getRegion();
2264                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2265                {
2266                    newObject = false;
2267                                    temp_obj4.addCustomer(obj1);
2268                                    break;
2269                }
2270            }
2271                            if (newObject)
2272            {
2273                obj4.initCustomers();
2274                obj4.addCustomer(obj1);
2275            }
2276                                                                                    
2277                                                        
2278                            
2279              
2280                           omClass = LanguagePeer.getOMClass();
2281                          Language obj5 = (Language)LanguagePeer
2282                .row2Object( row, offset5, omClass);
2283
2284               newObject = true;
2285            for (int j = 0; j < results.size(); j++)
2286            {
2287                Customer temp_obj1 = (Customer)results.get(j);
2288                Language temp_obj5 = (Language)temp_obj1.getLanguage();
2289                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2290                {
2291                    newObject = false;
2292                                    temp_obj5.addCustomer(obj1);
2293                                    break;
2294                }
2295            }
2296                            if (newObject)
2297            {
2298                obj5.initCustomers();
2299                obj5.addCustomer(obj1);
2300            }
2301                                                                                    
2302                                                                  
2303                                                        
2304                            
2305              
2306                           omClass = HouseholdCategoryPeer.getOMClass();
2307                          HouseholdCategory obj6 = (HouseholdCategory)HouseholdCategoryPeer
2308                .row2Object( row, offset6, omClass);
2309
2310               newObject = true;
2311            for (int j = 0; j < results.size(); j++)
2312            {
2313                Customer temp_obj1 = (Customer)results.get(j);
2314                HouseholdCategory temp_obj6 = (HouseholdCategory)temp_obj1.getHouseholdCategory();
2315                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2316                {
2317                    newObject = false;
2318                                    temp_obj6.addCustomer(obj1);
2319                                    break;
2320                }
2321            }
2322                            if (newObject)
2323            {
2324                obj6.initCustomers();
2325                obj6.addCustomer(obj1);
2326            }
2327                                                                results.add(obj1);
2328        }
2329        return results;
2330    }
2331        
2332        
2333                                  
2334                
2335
2336    /**
2337     * selects a collection of Customer objects pre-filled with
2338     * all related objects.
2339     *
2340     * This method is protected by default in order to keep the public
2341     * api reasonable. You can provide public methods for those you
2342     * actually need in CustomerPeer.
2343     *
2344     * @throws TorqueException Any exceptions caught during processing will be
2345     * rethrown wrapped into a TorqueException.
2346     */

2347    protected static List JavaDoc doSelectJoinAllExceptHouseholdCategory(Criteria criteria)
2348        throws TorqueException
2349    {
2350        setDbName(criteria);
2351
2352        addSelectColumns(criteria);
2353        int offset2 = numColumns + 1;
2354                                    
2355                    CustomerCategoryPeer.addSelectColumns(criteria);
2356        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
2357                                                                
2358                    CountryPeer.addSelectColumns(criteria);
2359        int offset4 = offset3 + CountryPeer.numColumns;
2360                                                                
2361                    RegionPeer.addSelectColumns(criteria);
2362        int offset5 = offset4 + RegionPeer.numColumns;
2363                                                                
2364                    LanguagePeer.addSelectColumns(criteria);
2365        int offset6 = offset5 + LanguagePeer.numColumns;
2366                                                                
2367                    EducationCategoryPeer.addSelectColumns(criteria);
2368        int offset7 = offset6 + EducationCategoryPeer.numColumns;
2369                                                                
2370                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
2371        List JavaDoc rows = BasePeer.doSelect(criteria);
2372        List JavaDoc results = new ArrayList JavaDoc();
2373
2374        for (int i = 0; i < rows.size(); i++)
2375        {
2376            Record row = (Record)rows.get(i);
2377
2378                            Class JavaDoc omClass = CustomerPeer.getOMClass();
2379                    Customer obj1 = (Customer)CustomerPeer
2380                .row2Object(row, 1, omClass);
2381                                                
2382                                                        
2383                            
2384              
2385                           omClass = CustomerCategoryPeer.getOMClass();
2386                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
2387                .row2Object( row, offset2, omClass);
2388
2389               boolean newObject = true;
2390            for (int j = 0; j < results.size(); j++)
2391            {
2392                Customer temp_obj1 = (Customer)results.get(j);
2393                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
2394                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2395                {
2396                    newObject = false;
2397                                    temp_obj2.addCustomer(obj1);
2398                                    break;
2399                }
2400            }
2401                            if (newObject)
2402            {
2403                obj2.initCustomers();
2404                obj2.addCustomer(obj1);
2405            }
2406                                                                                    
2407                                                        
2408                            
2409              
2410                           omClass = CountryPeer.getOMClass();
2411                          Country obj3 = (Country)CountryPeer
2412                .row2Object( row, offset3, omClass);
2413
2414               newObject = true;
2415            for (int j = 0; j < results.size(); j++)
2416            {
2417                Customer temp_obj1 = (Customer)results.get(j);
2418                Country temp_obj3 = (Country)temp_obj1.getCountry();
2419                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2420                {
2421                    newObject = false;
2422                                    temp_obj3.addCustomer(obj1);
2423                                    break;
2424                }
2425            }
2426                            if (newObject)
2427            {
2428                obj3.initCustomers();
2429                obj3.addCustomer(obj1);
2430            }
2431                                                                                    
2432                                                        
2433                            
2434              
2435                           omClass = RegionPeer.getOMClass();
2436                          Region obj4 = (Region)RegionPeer
2437                .row2Object( row, offset4, omClass);
2438
2439               newObject = true;
2440            for (int j = 0; j < results.size(); j++)
2441            {
2442                Customer temp_obj1 = (Customer)results.get(j);
2443                Region temp_obj4 = (Region)temp_obj1.getRegion();
2444                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2445                {
2446                    newObject = false;
2447                                    temp_obj4.addCustomer(obj1);
2448                                    break;
2449                }
2450            }
2451                            if (newObject)
2452            {
2453                obj4.initCustomers();
2454                obj4.addCustomer(obj1);
2455            }
2456                                                                                    
2457                                                        
2458                            
2459              
2460                           omClass = LanguagePeer.getOMClass();
2461                          Language obj5 = (Language)LanguagePeer
2462                .row2Object( row, offset5, omClass);
2463
2464               newObject = true;
2465            for (int j = 0; j < results.size(); j++)
2466            {
2467                Customer temp_obj1 = (Customer)results.get(j);
2468                Language temp_obj5 = (Language)temp_obj1.getLanguage();
2469                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2470                {
2471                    newObject = false;
2472                                    temp_obj5.addCustomer(obj1);
2473                                    break;
2474                }
2475            }
2476                            if (newObject)
2477            {
2478                obj5.initCustomers();
2479                obj5.addCustomer(obj1);
2480            }
2481                                                                                    
2482                                                        
2483                            
2484              
2485                           omClass = EducationCategoryPeer.getOMClass();
2486                          EducationCategory obj6 = (EducationCategory)EducationCategoryPeer
2487                .row2Object( row, offset6, omClass);
2488
2489               newObject = true;
2490            for (int j = 0; j < results.size(); j++)
2491            {
2492                Customer temp_obj1 = (Customer)results.get(j);
2493                EducationCategory temp_obj6 = (EducationCategory)temp_obj1.getEducationCategory();
2494                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2495                {
2496                    newObject = false;
2497                                    temp_obj6.addCustomer(obj1);
2498                                    break;
2499                }
2500            }
2501                            if (newObject)
2502            {
2503                obj6.initCustomers();
2504                obj6.addCustomer(obj1);
2505            }
2506                                                                                    
2507                                              results.add(obj1);
2508        }
2509        return results;
2510    }
2511                    
2512  
2513      /**
2514     * Returns the TableMap related to this peer. This method is not
2515     * needed for general use but a specific application could have a need.
2516     *
2517     * @throws TorqueException Any exceptions caught during processing will be
2518     * rethrown wrapped into a TorqueException.
2519     */

2520    protected static TableMap getTableMap()
2521        throws TorqueException
2522    {
2523        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
2524    }
2525   
2526    private static void setDbName(Criteria crit)
2527    {
2528        // Set the correct dbName if it has not been overridden
2529
// crit.getDbName will return the same object if not set to
2530
// another value so == check is okay and faster
2531
if (crit.getDbName() == Torque.getDefaultDB())
2532        {
2533            crit.setDbName(DATABASE_NAME);
2534        }
2535    }
2536}
2537
Popular Tags