KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

63     public static MapBuilder getMapBuilder()
64         throws TorqueException
65     {
66         return getMapBuilder(NewsletterMapBuilder.CLASS_NAME);
67     }
68
69       /** the column name for the NEWSLETTER_ID field */
70     public static final String JavaDoc NEWSLETTER_ID;
71       /** the column name for the NEWSLETTER_CODE field */
72     public static final String JavaDoc NEWSLETTER_CODE;
73       /** the column name for the STATUS field */
74     public static final String JavaDoc STATUS;
75       /** the column name for the PRIORITY field */
76     public static final String JavaDoc PRIORITY;
77       /** the column name for the ISSUED_DATE field */
78     public static final String JavaDoc ISSUED_DATE;
79       /** the column name for the CLOSED_DATE field */
80     public static final String JavaDoc CLOSED_DATE;
81       /** the column name for the SENT_TIME field */
82     public static final String JavaDoc SENT_TIME;
83       /** the column name for the EMAIL_FORMAT field */
84     public static final String JavaDoc EMAIL_FORMAT;
85       /** the column name for the LANGUAGE_ID field */
86     public static final String JavaDoc LANGUAGE_ID;
87       /** the column name for the CUSTOMER_CAT_ID field */
88     public static final String JavaDoc CUSTOMER_CAT_ID;
89       /** the column name for the CUSTOMER_TYPE field */
90     public static final String JavaDoc CUSTOMER_TYPE;
91       /** the column name for the CUST_LANGUAGE_ID field */
92     public static final String JavaDoc CUST_LANGUAGE_ID;
93       /** the column name for the CUST_COUNTRY_ID field */
94     public static final String JavaDoc CUST_COUNTRY_ID;
95       /** the column name for the REL_DOCUMENT field */
96     public static final String JavaDoc REL_DOCUMENT;
97       /** the column name for the REL_DOC_STATUS field */
98     public static final String JavaDoc REL_DOC_STATUS;
99       /** the column name for the REL_PROJECT_ID field */
100     public static final String JavaDoc REL_PROJECT_ID;
101       /** the column name for the REL_PRODUCT_ID field */
102     public static final String JavaDoc REL_PRODUCT_ID;
103       /** the column name for the PROJECT_ID field */
104     public static final String JavaDoc PROJECT_ID;
105       /** the column name for the PRODUCT_ID field */
106     public static final String JavaDoc PRODUCT_ID;
107       /** the column name for the SUBJECT field */
108     public static final String JavaDoc SUBJECT;
109       /** the column name for the BODY field */
110     public static final String JavaDoc BODY;
111       /** the column name for the NOTES field */
112     public static final String JavaDoc NOTES;
113       /** the column name for the CREATED field */
114     public static final String JavaDoc CREATED;
115       /** the column name for the MODIFIED field */
116     public static final String JavaDoc MODIFIED;
117       /** the column name for the CREATED_BY field */
118     public static final String JavaDoc CREATED_BY;
119       /** the column name for the MODIFIED_BY field */
120     public static final String JavaDoc MODIFIED_BY;
121   
122     static
123     {
124           NEWSLETTER_ID = "NEWSLETTER.NEWSLETTER_ID";
125           NEWSLETTER_CODE = "NEWSLETTER.NEWSLETTER_CODE";
126           STATUS = "NEWSLETTER.STATUS";
127           PRIORITY = "NEWSLETTER.PRIORITY";
128           ISSUED_DATE = "NEWSLETTER.ISSUED_DATE";
129           CLOSED_DATE = "NEWSLETTER.CLOSED_DATE";
130           SENT_TIME = "NEWSLETTER.SENT_TIME";
131           EMAIL_FORMAT = "NEWSLETTER.EMAIL_FORMAT";
132           LANGUAGE_ID = "NEWSLETTER.LANGUAGE_ID";
133           CUSTOMER_CAT_ID = "NEWSLETTER.CUSTOMER_CAT_ID";
134           CUSTOMER_TYPE = "NEWSLETTER.CUSTOMER_TYPE";
135           CUST_LANGUAGE_ID = "NEWSLETTER.CUST_LANGUAGE_ID";
136           CUST_COUNTRY_ID = "NEWSLETTER.CUST_COUNTRY_ID";
137           REL_DOCUMENT = "NEWSLETTER.REL_DOCUMENT";
138           REL_DOC_STATUS = "NEWSLETTER.REL_DOC_STATUS";
139           REL_PROJECT_ID = "NEWSLETTER.REL_PROJECT_ID";
140           REL_PRODUCT_ID = "NEWSLETTER.REL_PRODUCT_ID";
141           PROJECT_ID = "NEWSLETTER.PROJECT_ID";
142           PRODUCT_ID = "NEWSLETTER.PRODUCT_ID";
143           SUBJECT = "NEWSLETTER.SUBJECT";
144           BODY = "NEWSLETTER.BODY";
145           NOTES = "NEWSLETTER.NOTES";
146           CREATED = "NEWSLETTER.CREATED";
147           MODIFIED = "NEWSLETTER.MODIFIED";
148           CREATED_BY = "NEWSLETTER.CREATED_BY";
149           MODIFIED_BY = "NEWSLETTER.MODIFIED_BY";
150           if (Torque.isInit())
151         {
152             try
153             {
154                 getMapBuilder(NewsletterMapBuilder.CLASS_NAME);
155             }
156             catch (Exception JavaDoc e)
157             {
158                 log.error("Could not initialize Peer", e);
159             }
160         }
161         else
162         {
163             Torque.registerMapBuilder(NewsletterMapBuilder.CLASS_NAME);
164         }
165     }
166  
167     /** number of columns for this peer */
168     public static final int numColumns = 26;
169
170     /** A class that can be returned by this peer. */
171     protected static final String JavaDoc CLASSNAME_DEFAULT =
172         "org.campware.cream.om.Newsletter";
173
174     /** A class that can be returned by this peer. */
175     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
176
177     /**
178      * Class object initialization method.
179      *
180      * @param className name of the class to initialize
181      * @return the initialized class
182      */

183     private static Class JavaDoc initClass(String JavaDoc className)
184     {
185         Class JavaDoc c = null;
186         try
187         {
188             c = Class.forName(className);
189         }
190         catch (Throwable JavaDoc t)
191         {
192             log.error("A FATAL ERROR has occurred which should not "
193                 + "have happened under any circumstance. Please notify "
194                 + "the Torque developers <torque-dev@db.apache.org> "
195                 + "and give as many details as possible (including the error "
196                 + "stack trace).", t);
197
198             // Error objects should always be propogated.
199
if (t instanceof Error JavaDoc)
200             {
201                 throw (Error JavaDoc) t.fillInStackTrace();
202             }
203         }
204         return c;
205     }
206
207     /**
208      * Get the list of objects for a ResultSet. Please not that your
209      * resultset MUST return columns in the right order. You can use
210      * getFieldNames() in BaseObject to get the correct sequence.
211      *
212      * @param results the ResultSet
213      * @return the list of objects
214      * @throws TorqueException Any exceptions caught during processing will be
215      * rethrown wrapped into a TorqueException.
216      */

217     public static List JavaDoc resultSet2Objects(java.sql.ResultSet JavaDoc results)
218             throws TorqueException
219     {
220         try
221         {
222             QueryDataSet qds = null;
223             List JavaDoc rows = null;
224             try
225             {
226                 qds = new QueryDataSet(results);
227                 rows = getSelectResults(qds);
228             }
229             finally
230             {
231                 if (qds != null)
232                 {
233                     qds.close();
234                 }
235             }
236
237             return populateObjects(rows);
238         }
239         catch (SQLException JavaDoc e)
240         {
241             throw new TorqueException(e);
242         }
243         catch (DataSetException e)
244         {
245             throw new TorqueException(e);
246         }
247     }
248
249
250   
251     /**
252      * Method to do inserts.
253      *
254      * @param criteria object used to create the INSERT statement.
255      * @throws TorqueException Any exceptions caught during processing will be
256      * rethrown wrapped into a TorqueException.
257      */

258     public static ObjectKey doInsert(Criteria criteria)
259         throws TorqueException
260     {
261         return BaseNewsletterPeer
262             .doInsert(criteria, (Connection JavaDoc) null);
263     }
264
265     /**
266      * Method to do inserts. This method is to be used during a transaction,
267      * otherwise use the doInsert(Criteria) method. It will take care of
268      * the connection details internally.
269      *
270      * @param criteria object used to create the INSERT statement.
271      * @param con the connection to use
272      * @throws TorqueException Any exceptions caught during processing will be
273      * rethrown wrapped into a TorqueException.
274      */

275     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
276         throws TorqueException
277     {
278                                                                                                                                                               
279         setDbName(criteria);
280
281         if (con == null)
282         {
283             return BasePeer.doInsert(criteria);
284         }
285         else
286         {
287             return BasePeer.doInsert(criteria, con);
288         }
289     }
290
291     /**
292      * Add all the columns needed to create a new object.
293      *
294      * @param criteria object containing the columns to add.
295      * @throws TorqueException Any exceptions caught during processing will be
296      * rethrown wrapped into a TorqueException.
297      */

298     public static void addSelectColumns(Criteria criteria)
299             throws TorqueException
300     {
301           criteria.addSelectColumn(NEWSLETTER_ID);
302           criteria.addSelectColumn(NEWSLETTER_CODE);
303           criteria.addSelectColumn(STATUS);
304           criteria.addSelectColumn(PRIORITY);
305           criteria.addSelectColumn(ISSUED_DATE);
306           criteria.addSelectColumn(CLOSED_DATE);
307           criteria.addSelectColumn(SENT_TIME);
308           criteria.addSelectColumn(EMAIL_FORMAT);
309           criteria.addSelectColumn(LANGUAGE_ID);
310           criteria.addSelectColumn(CUSTOMER_CAT_ID);
311           criteria.addSelectColumn(CUSTOMER_TYPE);
312           criteria.addSelectColumn(CUST_LANGUAGE_ID);
313           criteria.addSelectColumn(CUST_COUNTRY_ID);
314           criteria.addSelectColumn(REL_DOCUMENT);
315           criteria.addSelectColumn(REL_DOC_STATUS);
316           criteria.addSelectColumn(REL_PROJECT_ID);
317           criteria.addSelectColumn(REL_PRODUCT_ID);
318           criteria.addSelectColumn(PROJECT_ID);
319           criteria.addSelectColumn(PRODUCT_ID);
320           criteria.addSelectColumn(SUBJECT);
321           criteria.addSelectColumn(BODY);
322           criteria.addSelectColumn(NOTES);
323           criteria.addSelectColumn(CREATED);
324           criteria.addSelectColumn(MODIFIED);
325           criteria.addSelectColumn(CREATED_BY);
326           criteria.addSelectColumn(MODIFIED_BY);
327       }
328
329     /**
330      * Create a new object of type cls from a resultset row starting
331      * from a specified offset. This is done so that you can select
332      * other rows than just those needed for this object. You may
333      * for example want to create two objects from the same row.
334      *
335      * @throws TorqueException Any exceptions caught during processing will be
336      * rethrown wrapped into a TorqueException.
337      */

338     public static Newsletter row2Object(Record row,
339                                              int offset,
340                                              Class JavaDoc cls)
341         throws TorqueException
342     {
343         try
344         {
345             Newsletter obj = (Newsletter) cls.newInstance();
346             NewsletterPeer.populateObject(row, offset, obj);
347                   obj.setModified(false);
348               obj.setNew(false);
349
350             return obj;
351         }
352         catch (InstantiationException JavaDoc e)
353         {
354             throw new TorqueException(e);
355         }
356         catch (IllegalAccessException JavaDoc e)
357         {
358             throw new TorqueException(e);
359         }
360     }
361
362     /**
363      * Populates an object from a resultset row starting
364      * from a specified offset. This is done so that you can select
365      * other rows than just those needed for this object. You may
366      * for example want to create two objects from the same row.
367      *
368      * @throws TorqueException Any exceptions caught during processing will be
369      * rethrown wrapped into a TorqueException.
370      */

371     public static void populateObject(Record row,
372                                       int offset,
373                                       Newsletter obj)
374         throws TorqueException
375     {
376         try
377         {
378                 obj.setNewsletterId(row.getValue(offset + 0).asInt());
379                   obj.setNewsletterCode(row.getValue(offset + 1).asString());
380                   obj.setStatus(row.getValue(offset + 2).asInt());
381                   obj.setPriority(row.getValue(offset + 3).asInt());
382                   obj.setIssuedDate(row.getValue(offset + 4).asUtilDate());
383                   obj.setClosedDate(row.getValue(offset + 5).asUtilDate());
384                   obj.setSentTime(row.getValue(offset + 6).asUtilDate());
385                   obj.setEmailFormat(row.getValue(offset + 7).asInt());
386                   obj.setLanguageId(row.getValue(offset + 8).asInt());
387                   obj.setCustomerCatId(row.getValue(offset + 9).asInt());
388                   obj.setCustomerType(row.getValue(offset + 10).asInt());
389                   obj.setCustLanguageId(row.getValue(offset + 11).asInt());
390                   obj.setCustCountryId(row.getValue(offset + 12).asInt());
391                   obj.setRelDocument(row.getValue(offset + 13).asInt());
392                   obj.setRelDocStatus(row.getValue(offset + 14).asInt());
393                   obj.setRelProjectId(row.getValue(offset + 15).asInt());
394                   obj.setRelProductId(row.getValue(offset + 16).asInt());
395                   obj.setProjectId(row.getValue(offset + 17).asInt());
396                   obj.setProductId(row.getValue(offset + 18).asInt());
397                   obj.setSubject(row.getValue(offset + 19).asString());
398                   obj.setBody(row.getValue(offset + 20).asString());
399                   obj.setNotes(row.getValue(offset + 21).asString());
400                   obj.setCreated(row.getValue(offset + 22).asUtilDate());
401                   obj.setModified(row.getValue(offset + 23).asUtilDate());
402                   obj.setCreatedBy(row.getValue(offset + 24).asString());
403                   obj.setModifiedBy(row.getValue(offset + 25).asString());
404               }
405         catch (DataSetException e)
406         {
407             throw new TorqueException(e);
408         }
409     }
410
411     /**
412      * Method to do selects.
413      *
414      * @param criteria object used to create the SELECT statement.
415      * @return List of selected Objects
416      * @throws TorqueException Any exceptions caught during processing will be
417      * rethrown wrapped into a TorqueException.
418      */

419     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
420     {
421         return populateObjects(doSelectVillageRecords(criteria));
422     }
423
424     /**
425      * Method to do selects within a transaction.
426      *
427      * @param criteria object used to create the SELECT statement.
428      * @param con the connection to use
429      * @return List of selected Objects
430      * @throws TorqueException Any exceptions caught during processing will be
431      * rethrown wrapped into a TorqueException.
432      */

433     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
434         throws TorqueException
435     {
436         return populateObjects(doSelectVillageRecords(criteria, con));
437     }
438
439     /**
440      * Grabs the raw Village records to be formed into objects.
441      * This method handles connections internally. The Record objects
442      * returned by this method should be considered readonly. Do not
443      * alter the data and call save(), your results may vary, but are
444      * certainly likely to result in hard to track MT bugs.
445      *
446      * @throws TorqueException Any exceptions caught during processing will be
447      * rethrown wrapped into a TorqueException.
448      */

449     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
450         throws TorqueException
451     {
452         return BaseNewsletterPeer
453             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
454     }
455
456     /**
457      * Grabs the raw Village records to be formed into objects.
458      * This method should be used for transactions
459      *
460      * @param criteria object used to create the SELECT statement.
461      * @param con the connection to use
462      * @throws TorqueException Any exceptions caught during processing will be
463      * rethrown wrapped into a TorqueException.
464      */

465     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
466         throws TorqueException
467     {
468         if (criteria.getSelectColumns().size() == 0)
469         {
470             addSelectColumns(criteria);
471         }
472
473                                                                                                                                                               
474         setDbName(criteria);
475
476         // BasePeer returns a List of Value (Village) arrays. The array
477
// order follows the order columns were placed in the Select clause.
478
if (con == null)
479         {
480             return BasePeer.doSelect(criteria);
481         }
482         else
483         {
484             return BasePeer.doSelect(criteria, con);
485         }
486     }
487
488     /**
489      * The returned List will contain objects of the default type or
490      * objects that inherit from the default.
491      *
492      * @throws TorqueException Any exceptions caught during processing will be
493      * rethrown wrapped into a TorqueException.
494      */

495     public static List JavaDoc populateObjects(List JavaDoc records)
496         throws TorqueException
497     {
498         List JavaDoc results = new ArrayList JavaDoc(records.size());
499
500         // populate the object(s)
501
for (int i = 0; i < records.size(); i++)
502         {
503             Record row = (Record) records.get(i);
504               results.add(NewsletterPeer.row2Object(row, 1,
505                 NewsletterPeer.getOMClass()));
506           }
507         return results;
508     }
509  
510
511     /**
512      * The class that the Peer will make instances of.
513      * If the BO is abstract then you must implement this method
514      * in the BO.
515      *
516      * @throws TorqueException Any exceptions caught during processing will be
517      * rethrown wrapped into a TorqueException.
518      */

519     public static Class JavaDoc getOMClass()
520         throws TorqueException
521     {
522         return CLASS_DEFAULT;
523     }
524
525     /**
526      * Method to do updates.
527      *
528      * @param criteria object containing data that is used to create the UPDATE
529      * statement.
530      * @throws TorqueException Any exceptions caught during processing will be
531      * rethrown wrapped into a TorqueException.
532      */

533     public static void doUpdate(Criteria criteria) throws TorqueException
534     {
535          BaseNewsletterPeer
536             .doUpdate(criteria, (Connection JavaDoc) null);
537     }
538
539     /**
540      * Method to do updates. This method is to be used during a transaction,
541      * otherwise use the doUpdate(Criteria) method. It will take care of
542      * the connection details internally.
543      *
544      * @param criteria object containing data that is used to create the UPDATE
545      * statement.
546      * @param con the connection to use
547      * @throws TorqueException Any exceptions caught during processing will be
548      * rethrown wrapped into a TorqueException.
549      */

550     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
551         throws TorqueException
552     {
553         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
554                    selectCriteria.put(NEWSLETTER_ID, criteria.remove(NEWSLETTER_ID));
555                                                                                                                                                                                                                                                                 
556         setDbName(criteria);
557
558         if (con == null)
559         {
560             BasePeer.doUpdate(selectCriteria, criteria);
561         }
562         else
563         {
564             BasePeer.doUpdate(selectCriteria, criteria, con);
565         }
566     }
567
568     /**
569      * Method to do deletes.
570      *
571      * @param criteria object containing data that is used DELETE from database.
572      * @throws TorqueException Any exceptions caught during processing will be
573      * rethrown wrapped into a TorqueException.
574      */

575      public static void doDelete(Criteria criteria) throws TorqueException
576      {
577          NewsletterPeer
578             .doDelete(criteria, (Connection JavaDoc) null);
579      }
580
581     /**
582      * Method to do deletes. This method is to be used during a transaction,
583      * otherwise use the doDelete(Criteria) method. It will take care of
584      * the connection details internally.
585      *
586      * @param criteria object containing data that is used DELETE from database.
587      * @param con the connection to use
588      * @throws TorqueException Any exceptions caught during processing will be
589      * rethrown wrapped into a TorqueException.
590      */

591      public static void doDelete(Criteria criteria, Connection JavaDoc con)
592         throws TorqueException
593      {
594                                                                                                                                                               
595         setDbName(criteria);
596
597         if (con == null)
598         {
599             BasePeer.doDelete(criteria);
600         }
601         else
602         {
603             BasePeer.doDelete(criteria, con);
604         }
605      }
606
607     /**
608      * Method to do selects
609      *
610      * @throws TorqueException Any exceptions caught during processing will be
611      * rethrown wrapped into a TorqueException.
612      */

613     public static List JavaDoc doSelect(Newsletter obj) throws TorqueException
614     {
615         return doSelect(buildSelectCriteria(obj));
616     }
617
618     /**
619      * Method to do inserts
620      *
621      * @throws TorqueException Any exceptions caught during processing will be
622      * rethrown wrapped into a TorqueException.
623      */

624     public static void doInsert(Newsletter obj) throws TorqueException
625     {
626           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
627           obj.setNew(false);
628         obj.setModified(false);
629     }
630
631     /**
632      * @param obj the data object to update in the database.
633      * @throws TorqueException Any exceptions caught during processing will be
634      * rethrown wrapped into a TorqueException.
635      */

636     public static void doUpdate(Newsletter obj) throws TorqueException
637     {
638         doUpdate(buildCriteria(obj));
639         obj.setModified(false);
640     }
641
642     /**
643      * @param obj the data object to delete in the database.
644      * @throws TorqueException Any exceptions caught during processing will be
645      * rethrown wrapped into a TorqueException.
646      */

647     public static void doDelete(Newsletter obj) throws TorqueException
648     {
649         doDelete(buildSelectCriteria(obj));
650     }
651
652     /**
653      * Method to do inserts. This method is to be used during a transaction,
654      * otherwise use the doInsert(Newsletter) method. It will take
655      * care of the connection details internally.
656      *
657      * @param obj the data object to insert into the database.
658      * @param con the connection to use
659      * @throws TorqueException Any exceptions caught during processing will be
660      * rethrown wrapped into a TorqueException.
661      */

662     public static void doInsert(Newsletter obj, Connection JavaDoc con)
663         throws TorqueException
664     {
665           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
666           obj.setNew(false);
667         obj.setModified(false);
668     }
669
670     /**
671      * Method to do update. This method is to be used during a transaction,
672      * otherwise use the doUpdate(Newsletter) method. It will take
673      * care of the connection details internally.
674      *
675      * @param obj the data object to update in the database.
676      * @param con the connection to use
677      * @throws TorqueException Any exceptions caught during processing will be
678      * rethrown wrapped into a TorqueException.
679      */

680     public static void doUpdate(Newsletter obj, Connection JavaDoc con)
681         throws TorqueException
682     {
683         doUpdate(buildCriteria(obj), con);
684         obj.setModified(false);
685     }
686
687     /**
688      * Method to delete. This method is to be used during a transaction,
689      * otherwise use the doDelete(Newsletter) method. It will take
690      * care of the connection details internally.
691      *
692      * @param obj the data object to delete in the database.
693      * @param con the connection to use
694      * @throws TorqueException Any exceptions caught during processing will be
695      * rethrown wrapped into a TorqueException.
696      */

697     public static void doDelete(Newsletter obj, Connection JavaDoc con)
698         throws TorqueException
699     {
700         doDelete(buildSelectCriteria(obj), con);
701     }
702
703     /**
704      * Method to do deletes.
705      *
706      * @param pk ObjectKey that is used DELETE from database.
707      * @throws TorqueException Any exceptions caught during processing will be
708      * rethrown wrapped into a TorqueException.
709      */

710     public static void doDelete(ObjectKey pk) throws TorqueException
711     {
712         BaseNewsletterPeer
713            .doDelete(pk, (Connection JavaDoc) null);
714     }
715
716     /**
717      * Method to delete. This method is to be used during a transaction,
718      * otherwise use the doDelete(ObjectKey) method. It will take
719      * care of the connection details internally.
720      *
721      * @param pk the primary key for the object to delete in the database.
722      * @param con the connection to use
723      * @throws TorqueException Any exceptions caught during processing will be
724      * rethrown wrapped into a TorqueException.
725      */

726     public static void doDelete(ObjectKey pk, Connection JavaDoc con)
727         throws TorqueException
728     {
729         doDelete(buildCriteria(pk), con);
730     }
731
732     /** Build a Criteria object from an ObjectKey */
733     public static Criteria buildCriteria( ObjectKey pk )
734     {
735         Criteria criteria = new Criteria();
736               criteria.add(NEWSLETTER_ID, pk);
737           return criteria;
738      }
739
740     /** Build a Criteria object from the data object for this peer */
741     public static Criteria buildCriteria( Newsletter obj )
742     {
743         Criteria criteria = new Criteria(DATABASE_NAME);
744               if (!obj.isNew())
745             criteria.add(NEWSLETTER_ID, obj.getNewsletterId());
746               criteria.add(NEWSLETTER_CODE, obj.getNewsletterCode());
747               criteria.add(STATUS, obj.getStatus());
748               criteria.add(PRIORITY, obj.getPriority());
749               criteria.add(ISSUED_DATE, obj.getIssuedDate());
750               criteria.add(CLOSED_DATE, obj.getClosedDate());
751               criteria.add(SENT_TIME, obj.getSentTime());
752               criteria.add(EMAIL_FORMAT, obj.getEmailFormat());
753               criteria.add(LANGUAGE_ID, obj.getLanguageId());
754               criteria.add(CUSTOMER_CAT_ID, obj.getCustomerCatId());
755               criteria.add(CUSTOMER_TYPE, obj.getCustomerType());
756               criteria.add(CUST_LANGUAGE_ID, obj.getCustLanguageId());
757               criteria.add(CUST_COUNTRY_ID, obj.getCustCountryId());
758               criteria.add(REL_DOCUMENT, obj.getRelDocument());
759               criteria.add(REL_DOC_STATUS, obj.getRelDocStatus());
760               criteria.add(REL_PROJECT_ID, obj.getRelProjectId());
761               criteria.add(REL_PRODUCT_ID, obj.getRelProductId());
762               criteria.add(PROJECT_ID, obj.getProjectId());
763               criteria.add(PRODUCT_ID, obj.getProductId());
764               criteria.add(SUBJECT, obj.getSubject());
765               criteria.add(BODY, obj.getBody());
766               criteria.add(NOTES, obj.getNotes());
767               criteria.add(CREATED, obj.getCreated());
768               criteria.add(MODIFIED, obj.getModified());
769               criteria.add(CREATED_BY, obj.getCreatedBy());
770               criteria.add(MODIFIED_BY, obj.getModifiedBy());
771           return criteria;
772     }
773
774     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
775     public static Criteria buildSelectCriteria( Newsletter obj )
776     {
777         Criteria criteria = new Criteria(DATABASE_NAME);
778               if (!obj.isNew())
779                     criteria.add(NEWSLETTER_ID, obj.getNewsletterId());
780                           criteria.add(NEWSLETTER_CODE, obj.getNewsletterCode());
781                           criteria.add(STATUS, obj.getStatus());
782                           criteria.add(PRIORITY, obj.getPriority());
783                           criteria.add(ISSUED_DATE, obj.getIssuedDate());
784                           criteria.add(CLOSED_DATE, obj.getClosedDate());
785                           criteria.add(SENT_TIME, obj.getSentTime());
786                           criteria.add(EMAIL_FORMAT, obj.getEmailFormat());
787                           criteria.add(LANGUAGE_ID, obj.getLanguageId());
788                           criteria.add(CUSTOMER_CAT_ID, obj.getCustomerCatId());
789                           criteria.add(CUSTOMER_TYPE, obj.getCustomerType());
790                           criteria.add(CUST_LANGUAGE_ID, obj.getCustLanguageId());
791                           criteria.add(CUST_COUNTRY_ID, obj.getCustCountryId());
792                           criteria.add(REL_DOCUMENT, obj.getRelDocument());
793                           criteria.add(REL_DOC_STATUS, obj.getRelDocStatus());
794                           criteria.add(REL_PROJECT_ID, obj.getRelProjectId());
795                           criteria.add(REL_PRODUCT_ID, obj.getRelProductId());
796                           criteria.add(PROJECT_ID, obj.getProjectId());
797                           criteria.add(PRODUCT_ID, obj.getProductId());
798                           criteria.add(SUBJECT, obj.getSubject());
799                           criteria.add(BODY, obj.getBody());
800                           criteria.add(NOTES, obj.getNotes());
801                           criteria.add(CREATED, obj.getCreated());
802                           criteria.add(MODIFIED, obj.getModified());
803                           criteria.add(CREATED_BY, obj.getCreatedBy());
804                           criteria.add(MODIFIED_BY, obj.getModifiedBy());
805               return criteria;
806     }
807  
808     
809         /**
810      * Retrieve a single object by pk
811      *
812      * @param pk the primary key
813      * @throws TorqueException Any exceptions caught during processing will be
814      * rethrown wrapped into a TorqueException.
815      * @throws NoRowsException Primary key was not found in database.
816      * @throws TooManyRowsException Primary key was not found in database.
817      */

818     public static Newsletter retrieveByPK(int pk)
819         throws TorqueException, NoRowsException, TooManyRowsException
820     {
821         return retrieveByPK(SimpleKey.keyFor(pk));
822     }
823
824     /**
825      * Retrieve a single object by pk
826      *
827      * @param pk the primary key
828      * @param con the connection to use
829      * @throws TorqueException Any exceptions caught during processing will be
830      * rethrown wrapped into a TorqueException.
831      * @throws NoRowsException Primary key was not found in database.
832      * @throws TooManyRowsException Primary key was not found in database.
833      */

834     public static Newsletter retrieveByPK(int pk, Connection JavaDoc con)
835         throws TorqueException, NoRowsException, TooManyRowsException
836     {
837         return retrieveByPK(SimpleKey.keyFor(pk), con);
838     }
839   
840     /**
841      * Retrieve a single object by pk
842      *
843      * @param pk the primary key
844      * @throws TorqueException Any exceptions caught during processing will be
845      * rethrown wrapped into a TorqueException.
846      * @throws NoRowsException Primary key was not found in database.
847      * @throws TooManyRowsException Primary key was not found in database.
848      */

849     public static Newsletter retrieveByPK(ObjectKey pk)
850         throws TorqueException, NoRowsException, TooManyRowsException
851     {
852         Connection JavaDoc db = null;
853         Newsletter retVal = null;
854         try
855         {
856             db = Torque.getConnection(DATABASE_NAME);
857             retVal = retrieveByPK(pk, db);
858         }
859         finally
860         {
861             Torque.closeConnection(db);
862         }
863         return(retVal);
864     }
865
866     /**
867      * Retrieve a single object by pk
868      *
869      * @param pk the primary key
870      * @param con the connection to use
871      * @throws TorqueException Any exceptions caught during processing will be
872      * rethrown wrapped into a TorqueException.
873      * @throws NoRowsException Primary key was not found in database.
874      * @throws TooManyRowsException Primary key was not found in database.
875      */

876     public static Newsletter retrieveByPK(ObjectKey pk, Connection JavaDoc con)
877         throws TorqueException, NoRowsException, TooManyRowsException
878     {
879         Criteria criteria = buildCriteria(pk);
880         List JavaDoc v = doSelect(criteria, con);
881         if (v.size() == 0)
882         {
883             throw new NoRowsException("Failed to select a row.");
884         }
885         else if (v.size() > 1)
886         {
887             throw new TooManyRowsException("Failed to select only one row.");
888         }
889         else
890         {
891             return (Newsletter)v.get(0);
892         }
893     }
894
895     /**
896      * Retrieve a multiple objects by pk
897      *
898      * @param pks List of primary keys
899      * @throws TorqueException Any exceptions caught during processing will be
900      * rethrown wrapped into a TorqueException.
901      */

902     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
903         throws TorqueException
904     {
905         Connection JavaDoc db = null;
906         List JavaDoc retVal = null;
907         try
908         {
909            db = Torque.getConnection(DATABASE_NAME);
910            retVal = retrieveByPKs(pks, db);
911         }
912         finally
913         {
914             Torque.closeConnection(db);
915         }
916         return(retVal);
917     }
918
919     /**
920      * Retrieve a multiple objects by pk
921      *
922      * @param pks List of primary keys
923      * @param dbcon the connection to use
924      * @throws TorqueException Any exceptions caught during processing will be
925      * rethrown wrapped into a TorqueException.
926      */

927     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
928         throws TorqueException
929     {
930         List JavaDoc objs = null;
931         if (pks == null || pks.size() == 0)
932         {
933             objs = new LinkedList JavaDoc();
934         }
935         else
936         {
937             Criteria criteria = new Criteria();
938               criteria.addIn( NEWSLETTER_ID, pks );
939           objs = doSelect(criteria, dbcon);
940         }
941         return objs;
942     }
943
944  
945
946
947
948                         
949                                               
950                 
951                 
952
953     /**
954      * selects a collection of Newsletter objects pre-filled with their
955      * CustomerCategory objects.
956      *
957      * This method is protected by default in order to keep the public
958      * api reasonable. You can provide public methods for those you
959      * actually need in NewsletterPeer.
960      *
961      * @throws TorqueException Any exceptions caught during processing will be
962      * rethrown wrapped into a TorqueException.
963      */

964     protected static List JavaDoc doSelectJoinCustomerCategory(Criteria criteria)
965         throws TorqueException
966     {
967         setDbName(criteria);
968
969         NewsletterPeer.addSelectColumns(criteria);
970         int offset = numColumns + 1;
971         CustomerCategoryPeer.addSelectColumns(criteria);
972
973
974                         criteria.addJoin(NewsletterPeer.CUSTOMER_CAT_ID,
975             CustomerCategoryPeer.CUSTOMER_CAT_ID);
976         
977
978                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
979         List JavaDoc rows = BasePeer.doSelect(criteria);
980         List JavaDoc results = new ArrayList JavaDoc();
981
982         for (int i = 0; i < rows.size(); i++)
983         {
984             Record row = (Record) rows.get(i);
985
986                             Class JavaDoc omClass = NewsletterPeer.getOMClass();
987                     Newsletter obj1 = (Newsletter) NewsletterPeer
988                 .row2Object(row, 1, omClass);
989                      omClass = CustomerCategoryPeer.getOMClass();
990                     CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
991                 .row2Object(row, offset, omClass);
992
993             boolean newObject = true;
994             for (int j = 0; j < results.size(); j++)
995             {
996                 Newsletter temp_obj1 = (Newsletter)results.get(j);
997                 CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
998                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
999                 {
1000                    newObject = false;
1001                              temp_obj2.addNewsletter(obj1);
1002                              break;
1003                }
1004            }
1005                      if (newObject)
1006            {
1007                obj2.initNewsletters();
1008                obj2.addNewsletter(obj1);
1009            }
1010                      results.add(obj1);
1011        }
1012        return results;
1013    }
1014                                                                      
1015                
1016                
1017
1018    /**
1019     * selects a collection of Newsletter objects pre-filled with their
1020     * Project objects.
1021     *
1022     * This method is protected by default in order to keep the public
1023     * api reasonable. You can provide public methods for those you
1024     * actually need in NewsletterPeer.
1025     *
1026     * @throws TorqueException Any exceptions caught during processing will be
1027     * rethrown wrapped into a TorqueException.
1028     */

1029    protected static List JavaDoc doSelectJoinProjectRelatedByProjectId(Criteria criteria)
1030        throws TorqueException
1031    {
1032        setDbName(criteria);
1033
1034        NewsletterPeer.addSelectColumns(criteria);
1035        int offset = numColumns + 1;
1036        ProjectPeer.addSelectColumns(criteria);
1037
1038
1039                        criteria.addJoin(NewsletterPeer.PROJECT_ID,
1040            ProjectPeer.PROJECT_ID);
1041        
1042
1043                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
1044        List JavaDoc rows = BasePeer.doSelect(criteria);
1045        List JavaDoc results = new ArrayList JavaDoc();
1046
1047        for (int i = 0; i < rows.size(); i++)
1048        {
1049            Record row = (Record) rows.get(i);
1050
1051                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1052                    Newsletter obj1 = (Newsletter) NewsletterPeer
1053                .row2Object(row, 1, omClass);
1054                     omClass = ProjectPeer.getOMClass();
1055                    Project obj2 = (Project)ProjectPeer
1056                .row2Object(row, offset, omClass);
1057
1058            boolean newObject = true;
1059            for (int j = 0; j < results.size(); j++)
1060            {
1061                Newsletter temp_obj1 = (Newsletter)results.get(j);
1062                Project temp_obj2 = (Project)temp_obj1.getProjectRelatedByProjectId();
1063                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1064                {
1065                    newObject = false;
1066                              temp_obj2.addNewsletterRelatedByProjectId(obj1);
1067                              break;
1068                }
1069            }
1070                      if (newObject)
1071            {
1072                obj2.initNewslettersRelatedByProjectId();
1073                obj2.addNewsletterRelatedByProjectId(obj1);
1074            }
1075                      results.add(obj1);
1076        }
1077        return results;
1078    }
1079                                                                      
1080                
1081                
1082
1083    /**
1084     * selects a collection of Newsletter objects pre-filled with their
1085     * Product objects.
1086     *
1087     * This method is protected by default in order to keep the public
1088     * api reasonable. You can provide public methods for those you
1089     * actually need in NewsletterPeer.
1090     *
1091     * @throws TorqueException Any exceptions caught during processing will be
1092     * rethrown wrapped into a TorqueException.
1093     */

1094    protected static List JavaDoc doSelectJoinProductRelatedByProductId(Criteria criteria)
1095        throws TorqueException
1096    {
1097        setDbName(criteria);
1098
1099        NewsletterPeer.addSelectColumns(criteria);
1100        int offset = numColumns + 1;
1101        ProductPeer.addSelectColumns(criteria);
1102
1103
1104                        criteria.addJoin(NewsletterPeer.PRODUCT_ID,
1105            ProductPeer.PRODUCT_ID);
1106        
1107
1108                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
1109        List JavaDoc rows = BasePeer.doSelect(criteria);
1110        List JavaDoc results = new ArrayList JavaDoc();
1111
1112        for (int i = 0; i < rows.size(); i++)
1113        {
1114            Record row = (Record) rows.get(i);
1115
1116                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1117                    Newsletter obj1 = (Newsletter) NewsletterPeer
1118                .row2Object(row, 1, omClass);
1119                     omClass = ProductPeer.getOMClass();
1120                    Product obj2 = (Product)ProductPeer
1121                .row2Object(row, offset, omClass);
1122
1123            boolean newObject = true;
1124            for (int j = 0; j < results.size(); j++)
1125            {
1126                Newsletter temp_obj1 = (Newsletter)results.get(j);
1127                Product temp_obj2 = (Product)temp_obj1.getProductRelatedByProductId();
1128                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1129                {
1130                    newObject = false;
1131                              temp_obj2.addNewsletterRelatedByProductId(obj1);
1132                              break;
1133                }
1134            }
1135                      if (newObject)
1136            {
1137                obj2.initNewslettersRelatedByProductId();
1138                obj2.addNewsletterRelatedByProductId(obj1);
1139            }
1140                      results.add(obj1);
1141        }
1142        return results;
1143    }
1144                                                                      
1145                
1146                
1147
1148    /**
1149     * selects a collection of Newsletter objects pre-filled with their
1150     * Project objects.
1151     *
1152     * This method is protected by default in order to keep the public
1153     * api reasonable. You can provide public methods for those you
1154     * actually need in NewsletterPeer.
1155     *
1156     * @throws TorqueException Any exceptions caught during processing will be
1157     * rethrown wrapped into a TorqueException.
1158     */

1159    protected static List JavaDoc doSelectJoinProjectRelatedByRelProjectId(Criteria criteria)
1160        throws TorqueException
1161    {
1162        setDbName(criteria);
1163
1164        NewsletterPeer.addSelectColumns(criteria);
1165        int offset = numColumns + 1;
1166        ProjectPeer.addSelectColumns(criteria);
1167
1168
1169                        criteria.addJoin(NewsletterPeer.REL_PROJECT_ID,
1170            ProjectPeer.PROJECT_ID);
1171        
1172
1173                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
1174        List JavaDoc rows = BasePeer.doSelect(criteria);
1175        List JavaDoc results = new ArrayList JavaDoc();
1176
1177        for (int i = 0; i < rows.size(); i++)
1178        {
1179            Record row = (Record) rows.get(i);
1180
1181                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1182                    Newsletter obj1 = (Newsletter) NewsletterPeer
1183                .row2Object(row, 1, omClass);
1184                     omClass = ProjectPeer.getOMClass();
1185                    Project obj2 = (Project)ProjectPeer
1186                .row2Object(row, offset, omClass);
1187
1188            boolean newObject = true;
1189            for (int j = 0; j < results.size(); j++)
1190            {
1191                Newsletter temp_obj1 = (Newsletter)results.get(j);
1192                Project temp_obj2 = (Project)temp_obj1.getProjectRelatedByRelProjectId();
1193                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1194                {
1195                    newObject = false;
1196                              temp_obj2.addNewsletterRelatedByRelProjectId(obj1);
1197                              break;
1198                }
1199            }
1200                      if (newObject)
1201            {
1202                obj2.initNewslettersRelatedByRelProjectId();
1203                obj2.addNewsletterRelatedByRelProjectId(obj1);
1204            }
1205                      results.add(obj1);
1206        }
1207        return results;
1208    }
1209                                                                      
1210                
1211                
1212
1213    /**
1214     * selects a collection of Newsletter objects pre-filled with their
1215     * Product objects.
1216     *
1217     * This method is protected by default in order to keep the public
1218     * api reasonable. You can provide public methods for those you
1219     * actually need in NewsletterPeer.
1220     *
1221     * @throws TorqueException Any exceptions caught during processing will be
1222     * rethrown wrapped into a TorqueException.
1223     */

1224    protected static List JavaDoc doSelectJoinProductRelatedByRelProductId(Criteria criteria)
1225        throws TorqueException
1226    {
1227        setDbName(criteria);
1228
1229        NewsletterPeer.addSelectColumns(criteria);
1230        int offset = numColumns + 1;
1231        ProductPeer.addSelectColumns(criteria);
1232
1233
1234                        criteria.addJoin(NewsletterPeer.REL_PRODUCT_ID,
1235            ProductPeer.PRODUCT_ID);
1236        
1237
1238                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
1239        List JavaDoc rows = BasePeer.doSelect(criteria);
1240        List JavaDoc results = new ArrayList JavaDoc();
1241
1242        for (int i = 0; i < rows.size(); i++)
1243        {
1244            Record row = (Record) rows.get(i);
1245
1246                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1247                    Newsletter obj1 = (Newsletter) NewsletterPeer
1248                .row2Object(row, 1, omClass);
1249                     omClass = ProductPeer.getOMClass();
1250                    Product obj2 = (Product)ProductPeer
1251                .row2Object(row, offset, omClass);
1252
1253            boolean newObject = true;
1254            for (int j = 0; j < results.size(); j++)
1255            {
1256                Newsletter temp_obj1 = (Newsletter)results.get(j);
1257                Product temp_obj2 = (Product)temp_obj1.getProductRelatedByRelProductId();
1258                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1259                {
1260                    newObject = false;
1261                              temp_obj2.addNewsletterRelatedByRelProductId(obj1);
1262                              break;
1263                }
1264            }
1265                      if (newObject)
1266            {
1267                obj2.initNewslettersRelatedByRelProductId();
1268                obj2.addNewsletterRelatedByRelProductId(obj1);
1269            }
1270                      results.add(obj1);
1271        }
1272        return results;
1273    }
1274                                                            
1275                
1276                
1277
1278    /**
1279     * selects a collection of Newsletter objects pre-filled with their
1280     * Country objects.
1281     *
1282     * This method is protected by default in order to keep the public
1283     * api reasonable. You can provide public methods for those you
1284     * actually need in NewsletterPeer.
1285     *
1286     * @throws TorqueException Any exceptions caught during processing will be
1287     * rethrown wrapped into a TorqueException.
1288     */

1289    protected static List JavaDoc doSelectJoinCountry(Criteria criteria)
1290        throws TorqueException
1291    {
1292        setDbName(criteria);
1293
1294        NewsletterPeer.addSelectColumns(criteria);
1295        int offset = numColumns + 1;
1296        CountryPeer.addSelectColumns(criteria);
1297
1298
1299                        criteria.addJoin(NewsletterPeer.CUST_COUNTRY_ID,
1300            CountryPeer.COUNTRY_ID);
1301        
1302
1303                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
1304        List JavaDoc rows = BasePeer.doSelect(criteria);
1305        List JavaDoc results = new ArrayList JavaDoc();
1306
1307        for (int i = 0; i < rows.size(); i++)
1308        {
1309            Record row = (Record) rows.get(i);
1310
1311                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1312                    Newsletter obj1 = (Newsletter) NewsletterPeer
1313                .row2Object(row, 1, omClass);
1314                     omClass = CountryPeer.getOMClass();
1315                    Country obj2 = (Country)CountryPeer
1316                .row2Object(row, offset, omClass);
1317
1318            boolean newObject = true;
1319            for (int j = 0; j < results.size(); j++)
1320            {
1321                Newsletter temp_obj1 = (Newsletter)results.get(j);
1322                Country temp_obj2 = (Country)temp_obj1.getCountry();
1323                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1324                {
1325                    newObject = false;
1326                              temp_obj2.addNewsletter(obj1);
1327                              break;
1328                }
1329            }
1330                      if (newObject)
1331            {
1332                obj2.initNewsletters();
1333                obj2.addNewsletter(obj1);
1334            }
1335                      results.add(obj1);
1336        }
1337        return results;
1338    }
1339                                                                      
1340                
1341                
1342
1343    /**
1344     * selects a collection of Newsletter objects pre-filled with their
1345     * Language objects.
1346     *
1347     * This method is protected by default in order to keep the public
1348     * api reasonable. You can provide public methods for those you
1349     * actually need in NewsletterPeer.
1350     *
1351     * @throws TorqueException Any exceptions caught during processing will be
1352     * rethrown wrapped into a TorqueException.
1353     */

1354    protected static List JavaDoc doSelectJoinLanguageRelatedByCustLanguageId(Criteria criteria)
1355        throws TorqueException
1356    {
1357        setDbName(criteria);
1358
1359        NewsletterPeer.addSelectColumns(criteria);
1360        int offset = numColumns + 1;
1361        LanguagePeer.addSelectColumns(criteria);
1362
1363
1364                        criteria.addJoin(NewsletterPeer.CUST_LANGUAGE_ID,
1365            LanguagePeer.LANGUAGE_ID);
1366        
1367
1368                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
1369        List JavaDoc rows = BasePeer.doSelect(criteria);
1370        List JavaDoc results = new ArrayList JavaDoc();
1371
1372        for (int i = 0; i < rows.size(); i++)
1373        {
1374            Record row = (Record) rows.get(i);
1375
1376                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1377                    Newsletter obj1 = (Newsletter) NewsletterPeer
1378                .row2Object(row, 1, omClass);
1379                     omClass = LanguagePeer.getOMClass();
1380                    Language obj2 = (Language)LanguagePeer
1381                .row2Object(row, offset, omClass);
1382
1383            boolean newObject = true;
1384            for (int j = 0; j < results.size(); j++)
1385            {
1386                Newsletter temp_obj1 = (Newsletter)results.get(j);
1387                Language temp_obj2 = (Language)temp_obj1.getLanguageRelatedByCustLanguageId();
1388                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1389                {
1390                    newObject = false;
1391                              temp_obj2.addNewsletterRelatedByCustLanguageId(obj1);
1392                              break;
1393                }
1394            }
1395                      if (newObject)
1396            {
1397                obj2.initNewslettersRelatedByCustLanguageId();
1398                obj2.addNewsletterRelatedByCustLanguageId(obj1);
1399            }
1400                      results.add(obj1);
1401        }
1402        return results;
1403    }
1404                                                                      
1405                
1406                
1407
1408    /**
1409     * selects a collection of Newsletter objects pre-filled with their
1410     * Language objects.
1411     *
1412     * This method is protected by default in order to keep the public
1413     * api reasonable. You can provide public methods for those you
1414     * actually need in NewsletterPeer.
1415     *
1416     * @throws TorqueException Any exceptions caught during processing will be
1417     * rethrown wrapped into a TorqueException.
1418     */

1419    protected static List JavaDoc doSelectJoinLanguageRelatedByLanguageId(Criteria criteria)
1420        throws TorqueException
1421    {
1422        setDbName(criteria);
1423
1424        NewsletterPeer.addSelectColumns(criteria);
1425        int offset = numColumns + 1;
1426        LanguagePeer.addSelectColumns(criteria);
1427
1428
1429                        criteria.addJoin(NewsletterPeer.LANGUAGE_ID,
1430            LanguagePeer.LANGUAGE_ID);
1431        
1432
1433                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            
1434        List JavaDoc rows = BasePeer.doSelect(criteria);
1435        List JavaDoc results = new ArrayList JavaDoc();
1436
1437        for (int i = 0; i < rows.size(); i++)
1438        {
1439            Record row = (Record) rows.get(i);
1440
1441                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1442                    Newsletter obj1 = (Newsletter) NewsletterPeer
1443                .row2Object(row, 1, omClass);
1444                     omClass = LanguagePeer.getOMClass();
1445                    Language obj2 = (Language)LanguagePeer
1446                .row2Object(row, offset, omClass);
1447
1448            boolean newObject = true;
1449            for (int j = 0; j < results.size(); j++)
1450            {
1451                Newsletter temp_obj1 = (Newsletter)results.get(j);
1452                Language temp_obj2 = (Language)temp_obj1.getLanguageRelatedByLanguageId();
1453                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1454                {
1455                    newObject = false;
1456                              temp_obj2.addNewsletterRelatedByLanguageId(obj1);
1457                              break;
1458                }
1459            }
1460                      if (newObject)
1461            {
1462                obj2.initNewslettersRelatedByLanguageId();
1463                obj2.addNewsletterRelatedByLanguageId(obj1);
1464            }
1465                      results.add(obj1);
1466        }
1467        return results;
1468    }
1469                    
1470  
1471                                                                                      
1472          
1473        
1474                                  
1475                
1476
1477    /**
1478     * selects a collection of Newsletter objects pre-filled with
1479     * all related objects.
1480     *
1481     * This method is protected by default in order to keep the public
1482     * api reasonable. You can provide public methods for those you
1483     * actually need in NewsletterPeer.
1484     *
1485     * @throws TorqueException Any exceptions caught during processing will be
1486     * rethrown wrapped into a TorqueException.
1487     */

1488    protected static List JavaDoc doSelectJoinAllExceptCustomerCategory(Criteria criteria)
1489        throws TorqueException
1490    {
1491        setDbName(criteria);
1492
1493        addSelectColumns(criteria);
1494        int offset2 = numColumns + 1;
1495                                    
1496                                                  
1497                    ProjectPeer.addSelectColumns(criteria);
1498        int offset3 = offset2 + ProjectPeer.numColumns;
1499                                                                
1500                    ProductPeer.addSelectColumns(criteria);
1501        int offset4 = offset3 + ProductPeer.numColumns;
1502                                                                
1503                    ProjectPeer.addSelectColumns(criteria);
1504        int offset5 = offset4 + ProjectPeer.numColumns;
1505                                                                
1506                    ProductPeer.addSelectColumns(criteria);
1507        int offset6 = offset5 + ProductPeer.numColumns;
1508                                                                
1509                    CountryPeer.addSelectColumns(criteria);
1510        int offset7 = offset6 + CountryPeer.numColumns;
1511                                                                
1512                    LanguagePeer.addSelectColumns(criteria);
1513        int offset8 = offset7 + LanguagePeer.numColumns;
1514                                                                
1515                    LanguagePeer.addSelectColumns(criteria);
1516        int offset9 = offset8 + LanguagePeer.numColumns;
1517                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
1518        List JavaDoc rows = BasePeer.doSelect(criteria);
1519        List JavaDoc results = new ArrayList JavaDoc();
1520
1521        for (int i = 0; i < rows.size(); i++)
1522        {
1523            Record row = (Record)rows.get(i);
1524
1525                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1526                    Newsletter obj1 = (Newsletter)NewsletterPeer
1527                .row2Object(row, 1, omClass);
1528                                                
1529                                                                  
1530                                                                        
1531                            
1532              
1533                           omClass = ProjectPeer.getOMClass();
1534                          Project obj2 = (Project)ProjectPeer
1535                .row2Object( row, offset2, omClass);
1536
1537               boolean newObject = true;
1538            for (int j = 0; j < results.size(); j++)
1539            {
1540                Newsletter temp_obj1 = (Newsletter)results.get(j);
1541                Project temp_obj2 = (Project)temp_obj1.getProjectRelatedByProjectId();
1542                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1543                {
1544                    newObject = false;
1545                                    temp_obj2.addNewsletterRelatedByProjectId(obj1);
1546                                    break;
1547                }
1548            }
1549                            if (newObject)
1550            {
1551                obj2.initNewslettersRelatedByProjectId();
1552                obj2.addNewsletterRelatedByProjectId(obj1);
1553            }
1554                                                                                    
1555                                                                        
1556                            
1557              
1558                           omClass = ProductPeer.getOMClass();
1559                          Product obj3 = (Product)ProductPeer
1560                .row2Object( row, offset3, omClass);
1561
1562               newObject = true;
1563            for (int j = 0; j < results.size(); j++)
1564            {
1565                Newsletter temp_obj1 = (Newsletter)results.get(j);
1566                Product temp_obj3 = (Product)temp_obj1.getProductRelatedByProductId();
1567                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1568                {
1569                    newObject = false;
1570                                    temp_obj3.addNewsletterRelatedByProductId(obj1);
1571                                    break;
1572                }
1573            }
1574                            if (newObject)
1575            {
1576                obj3.initNewslettersRelatedByProductId();
1577                obj3.addNewsletterRelatedByProductId(obj1);
1578            }
1579                                                                                    
1580                                                                        
1581                            
1582              
1583                           omClass = ProjectPeer.getOMClass();
1584                          Project obj4 = (Project)ProjectPeer
1585                .row2Object( row, offset4, omClass);
1586
1587               newObject = true;
1588            for (int j = 0; j < results.size(); j++)
1589            {
1590                Newsletter temp_obj1 = (Newsletter)results.get(j);
1591                Project temp_obj4 = (Project)temp_obj1.getProjectRelatedByRelProjectId();
1592                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1593                {
1594                    newObject = false;
1595                                    temp_obj4.addNewsletterRelatedByRelProjectId(obj1);
1596                                    break;
1597                }
1598            }
1599                            if (newObject)
1600            {
1601                obj4.initNewslettersRelatedByRelProjectId();
1602                obj4.addNewsletterRelatedByRelProjectId(obj1);
1603            }
1604                                                                                    
1605                                                                        
1606                            
1607              
1608                           omClass = ProductPeer.getOMClass();
1609                          Product obj5 = (Product)ProductPeer
1610                .row2Object( row, offset5, omClass);
1611
1612               newObject = true;
1613            for (int j = 0; j < results.size(); j++)
1614            {
1615                Newsletter temp_obj1 = (Newsletter)results.get(j);
1616                Product temp_obj5 = (Product)temp_obj1.getProductRelatedByRelProductId();
1617                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1618                {
1619                    newObject = false;
1620                                    temp_obj5.addNewsletterRelatedByRelProductId(obj1);
1621                                    break;
1622                }
1623            }
1624                            if (newObject)
1625            {
1626                obj5.initNewslettersRelatedByRelProductId();
1627                obj5.addNewsletterRelatedByRelProductId(obj1);
1628            }
1629                                                                                    
1630                                                        
1631                            
1632              
1633                           omClass = CountryPeer.getOMClass();
1634                          Country obj6 = (Country)CountryPeer
1635                .row2Object( row, offset6, omClass);
1636
1637               newObject = true;
1638            for (int j = 0; j < results.size(); j++)
1639            {
1640                Newsletter temp_obj1 = (Newsletter)results.get(j);
1641                Country temp_obj6 = (Country)temp_obj1.getCountry();
1642                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1643                {
1644                    newObject = false;
1645                                    temp_obj6.addNewsletter(obj1);
1646                                    break;
1647                }
1648            }
1649                            if (newObject)
1650            {
1651                obj6.initNewsletters();
1652                obj6.addNewsletter(obj1);
1653            }
1654                                                                                    
1655                                                                        
1656                            
1657              
1658                           omClass = LanguagePeer.getOMClass();
1659                          Language obj7 = (Language)LanguagePeer
1660                .row2Object( row, offset7, omClass);
1661
1662               newObject = true;
1663            for (int j = 0; j < results.size(); j++)
1664            {
1665                Newsletter temp_obj1 = (Newsletter)results.get(j);
1666                Language temp_obj7 = (Language)temp_obj1.getLanguageRelatedByCustLanguageId();
1667                if (temp_obj7.getPrimaryKey().equals(obj7.getPrimaryKey()))
1668                {
1669                    newObject = false;
1670                                    temp_obj7.addNewsletterRelatedByCustLanguageId(obj1);
1671                                    break;
1672                }
1673            }
1674                            if (newObject)
1675            {
1676                obj7.initNewslettersRelatedByCustLanguageId();
1677                obj7.addNewsletterRelatedByCustLanguageId(obj1);
1678            }
1679                                                                                    
1680                                                                        
1681                            
1682              
1683                           omClass = LanguagePeer.getOMClass();
1684                          Language obj8 = (Language)LanguagePeer
1685                .row2Object( row, offset8, omClass);
1686
1687               newObject = true;
1688            for (int j = 0; j < results.size(); j++)
1689            {
1690                Newsletter temp_obj1 = (Newsletter)results.get(j);
1691                Language temp_obj8 = (Language)temp_obj1.getLanguageRelatedByLanguageId();
1692                if (temp_obj8.getPrimaryKey().equals(obj8.getPrimaryKey()))
1693                {
1694                    newObject = false;
1695                                    temp_obj8.addNewsletterRelatedByLanguageId(obj1);
1696                                    break;
1697                }
1698            }
1699                            if (newObject)
1700            {
1701                obj8.initNewslettersRelatedByLanguageId();
1702                obj8.addNewsletterRelatedByLanguageId(obj1);
1703            }
1704                                                                results.add(obj1);
1705        }
1706        return results;
1707    }
1708        
1709        
1710                                            
1711                
1712
1713    /**
1714     * selects a collection of Newsletter objects pre-filled with
1715     * all related objects.
1716     *
1717     * This method is protected by default in order to keep the public
1718     * api reasonable. You can provide public methods for those you
1719     * actually need in NewsletterPeer.
1720     *
1721     * @throws TorqueException Any exceptions caught during processing will be
1722     * rethrown wrapped into a TorqueException.
1723     */

1724    protected static List JavaDoc doSelectJoinAllExceptProjectRelatedByProjectId(Criteria criteria)
1725        throws TorqueException
1726    {
1727        setDbName(criteria);
1728
1729        addSelectColumns(criteria);
1730        int offset2 = numColumns + 1;
1731                                    
1732                    CustomerCategoryPeer.addSelectColumns(criteria);
1733        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
1734                                                                
1735                                                  
1736                    ProductPeer.addSelectColumns(criteria);
1737        int offset4 = offset3 + ProductPeer.numColumns;
1738                                                                
1739                                                  
1740                    ProductPeer.addSelectColumns(criteria);
1741        int offset5 = offset4 + ProductPeer.numColumns;
1742                                                                
1743                    CountryPeer.addSelectColumns(criteria);
1744        int offset6 = offset5 + CountryPeer.numColumns;
1745                                                                
1746                    LanguagePeer.addSelectColumns(criteria);
1747        int offset7 = offset6 + LanguagePeer.numColumns;
1748                                                                
1749                    LanguagePeer.addSelectColumns(criteria);
1750        int offset8 = offset7 + LanguagePeer.numColumns;
1751                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
1752        List JavaDoc rows = BasePeer.doSelect(criteria);
1753        List JavaDoc results = new ArrayList JavaDoc();
1754
1755        for (int i = 0; i < rows.size(); i++)
1756        {
1757            Record row = (Record)rows.get(i);
1758
1759                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1760                    Newsletter obj1 = (Newsletter)NewsletterPeer
1761                .row2Object(row, 1, omClass);
1762                                                
1763                                                        
1764                            
1765              
1766                           omClass = CustomerCategoryPeer.getOMClass();
1767                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
1768                .row2Object( row, offset2, omClass);
1769
1770               boolean newObject = true;
1771            for (int j = 0; j < results.size(); j++)
1772            {
1773                Newsletter temp_obj1 = (Newsletter)results.get(j);
1774                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
1775                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1776                {
1777                    newObject = false;
1778                                    temp_obj2.addNewsletter(obj1);
1779                                    break;
1780                }
1781            }
1782                            if (newObject)
1783            {
1784                obj2.initNewsletters();
1785                obj2.addNewsletter(obj1);
1786            }
1787                                                                                    
1788                                                                  
1789                                                                        
1790                            
1791              
1792                           omClass = ProductPeer.getOMClass();
1793                          Product obj3 = (Product)ProductPeer
1794                .row2Object( row, offset3, omClass);
1795
1796               newObject = true;
1797            for (int j = 0; j < results.size(); j++)
1798            {
1799                Newsletter temp_obj1 = (Newsletter)results.get(j);
1800                Product temp_obj3 = (Product)temp_obj1.getProductRelatedByProductId();
1801                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1802                {
1803                    newObject = false;
1804                                    temp_obj3.addNewsletterRelatedByProductId(obj1);
1805                                    break;
1806                }
1807            }
1808                            if (newObject)
1809            {
1810                obj3.initNewslettersRelatedByProductId();
1811                obj3.addNewsletterRelatedByProductId(obj1);
1812            }
1813                                                                                    
1814                                                                  
1815                                                                        
1816                            
1817              
1818                           omClass = ProductPeer.getOMClass();
1819                          Product obj4 = (Product)ProductPeer
1820                .row2Object( row, offset4, omClass);
1821
1822               newObject = true;
1823            for (int j = 0; j < results.size(); j++)
1824            {
1825                Newsletter temp_obj1 = (Newsletter)results.get(j);
1826                Product temp_obj4 = (Product)temp_obj1.getProductRelatedByRelProductId();
1827                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1828                {
1829                    newObject = false;
1830                                    temp_obj4.addNewsletterRelatedByRelProductId(obj1);
1831                                    break;
1832                }
1833            }
1834                            if (newObject)
1835            {
1836                obj4.initNewslettersRelatedByRelProductId();
1837                obj4.addNewsletterRelatedByRelProductId(obj1);
1838            }
1839                                                                                    
1840                                                        
1841                            
1842              
1843                           omClass = CountryPeer.getOMClass();
1844                          Country obj5 = (Country)CountryPeer
1845                .row2Object( row, offset5, omClass);
1846
1847               newObject = true;
1848            for (int j = 0; j < results.size(); j++)
1849            {
1850                Newsletter temp_obj1 = (Newsletter)results.get(j);
1851                Country temp_obj5 = (Country)temp_obj1.getCountry();
1852                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1853                {
1854                    newObject = false;
1855                                    temp_obj5.addNewsletter(obj1);
1856                                    break;
1857                }
1858            }
1859                            if (newObject)
1860            {
1861                obj5.initNewsletters();
1862                obj5.addNewsletter(obj1);
1863            }
1864                                                                                    
1865                                                                        
1866                            
1867              
1868                           omClass = LanguagePeer.getOMClass();
1869                          Language obj6 = (Language)LanguagePeer
1870                .row2Object( row, offset6, omClass);
1871
1872               newObject = true;
1873            for (int j = 0; j < results.size(); j++)
1874            {
1875                Newsletter temp_obj1 = (Newsletter)results.get(j);
1876                Language temp_obj6 = (Language)temp_obj1.getLanguageRelatedByCustLanguageId();
1877                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1878                {
1879                    newObject = false;
1880                                    temp_obj6.addNewsletterRelatedByCustLanguageId(obj1);
1881                                    break;
1882                }
1883            }
1884                            if (newObject)
1885            {
1886                obj6.initNewslettersRelatedByCustLanguageId();
1887                obj6.addNewsletterRelatedByCustLanguageId(obj1);
1888            }
1889                                                                                    
1890                                                                        
1891                            
1892              
1893                           omClass = LanguagePeer.getOMClass();
1894                          Language obj7 = (Language)LanguagePeer
1895                .row2Object( row, offset7, omClass);
1896
1897               newObject = true;
1898            for (int j = 0; j < results.size(); j++)
1899            {
1900                Newsletter temp_obj1 = (Newsletter)results.get(j);
1901                Language temp_obj7 = (Language)temp_obj1.getLanguageRelatedByLanguageId();
1902                if (temp_obj7.getPrimaryKey().equals(obj7.getPrimaryKey()))
1903                {
1904                    newObject = false;
1905                                    temp_obj7.addNewsletterRelatedByLanguageId(obj1);
1906                                    break;
1907                }
1908            }
1909                            if (newObject)
1910            {
1911                obj7.initNewslettersRelatedByLanguageId();
1912                obj7.addNewsletterRelatedByLanguageId(obj1);
1913            }
1914                                                                results.add(obj1);
1915        }
1916        return results;
1917    }
1918        
1919        
1920                                            
1921                
1922
1923    /**
1924     * selects a collection of Newsletter objects pre-filled with
1925     * all related objects.
1926     *
1927     * This method is protected by default in order to keep the public
1928     * api reasonable. You can provide public methods for those you
1929     * actually need in NewsletterPeer.
1930     *
1931     * @throws TorqueException Any exceptions caught during processing will be
1932     * rethrown wrapped into a TorqueException.
1933     */

1934    protected static List JavaDoc doSelectJoinAllExceptProductRelatedByProductId(Criteria criteria)
1935        throws TorqueException
1936    {
1937        setDbName(criteria);
1938
1939        addSelectColumns(criteria);
1940        int offset2 = numColumns + 1;
1941                                    
1942                    CustomerCategoryPeer.addSelectColumns(criteria);
1943        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
1944                                                                
1945                    ProjectPeer.addSelectColumns(criteria);
1946        int offset4 = offset3 + ProjectPeer.numColumns;
1947                                                                
1948                                                  
1949                    ProjectPeer.addSelectColumns(criteria);
1950        int offset5 = offset4 + ProjectPeer.numColumns;
1951                                                                
1952                                                  
1953                    CountryPeer.addSelectColumns(criteria);
1954        int offset6 = offset5 + CountryPeer.numColumns;
1955                                                                
1956                    LanguagePeer.addSelectColumns(criteria);
1957        int offset7 = offset6 + LanguagePeer.numColumns;
1958                                                                
1959                    LanguagePeer.addSelectColumns(criteria);
1960        int offset8 = offset7 + LanguagePeer.numColumns;
1961                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
1962        List JavaDoc rows = BasePeer.doSelect(criteria);
1963        List JavaDoc results = new ArrayList JavaDoc();
1964
1965        for (int i = 0; i < rows.size(); i++)
1966        {
1967            Record row = (Record)rows.get(i);
1968
1969                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
1970                    Newsletter obj1 = (Newsletter)NewsletterPeer
1971                .row2Object(row, 1, omClass);
1972                                                
1973                                                        
1974                            
1975              
1976                           omClass = CustomerCategoryPeer.getOMClass();
1977                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
1978                .row2Object( row, offset2, omClass);
1979
1980               boolean newObject = true;
1981            for (int j = 0; j < results.size(); j++)
1982            {
1983                Newsletter temp_obj1 = (Newsletter)results.get(j);
1984                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
1985                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1986                {
1987                    newObject = false;
1988                                    temp_obj2.addNewsletter(obj1);
1989                                    break;
1990                }
1991            }
1992                            if (newObject)
1993            {
1994                obj2.initNewsletters();
1995                obj2.addNewsletter(obj1);
1996            }
1997                                                                                    
1998                                                                        
1999                            
2000              
2001                           omClass = ProjectPeer.getOMClass();
2002                          Project obj3 = (Project)ProjectPeer
2003                .row2Object( row, offset3, omClass);
2004
2005               newObject = true;
2006            for (int j = 0; j < results.size(); j++)
2007            {
2008                Newsletter temp_obj1 = (Newsletter)results.get(j);
2009                Project temp_obj3 = (Project)temp_obj1.getProjectRelatedByProjectId();
2010                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2011                {
2012                    newObject = false;
2013                                    temp_obj3.addNewsletterRelatedByProjectId(obj1);
2014                                    break;
2015                }
2016            }
2017                            if (newObject)
2018            {
2019                obj3.initNewslettersRelatedByProjectId();
2020                obj3.addNewsletterRelatedByProjectId(obj1);
2021            }
2022                                                                                    
2023                                                                  
2024                                                                        
2025                            
2026              
2027                           omClass = ProjectPeer.getOMClass();
2028                          Project obj4 = (Project)ProjectPeer
2029                .row2Object( row, offset4, omClass);
2030
2031               newObject = true;
2032            for (int j = 0; j < results.size(); j++)
2033            {
2034                Newsletter temp_obj1 = (Newsletter)results.get(j);
2035                Project temp_obj4 = (Project)temp_obj1.getProjectRelatedByRelProjectId();
2036                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2037                {
2038                    newObject = false;
2039                                    temp_obj4.addNewsletterRelatedByRelProjectId(obj1);
2040                                    break;
2041                }
2042            }
2043                            if (newObject)
2044            {
2045                obj4.initNewslettersRelatedByRelProjectId();
2046                obj4.addNewsletterRelatedByRelProjectId(obj1);
2047            }
2048                                                                                    
2049                                                                  
2050                                                        
2051                            
2052              
2053                           omClass = CountryPeer.getOMClass();
2054                          Country obj5 = (Country)CountryPeer
2055                .row2Object( row, offset5, omClass);
2056
2057               newObject = true;
2058            for (int j = 0; j < results.size(); j++)
2059            {
2060                Newsletter temp_obj1 = (Newsletter)results.get(j);
2061                Country temp_obj5 = (Country)temp_obj1.getCountry();
2062                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2063                {
2064                    newObject = false;
2065                                    temp_obj5.addNewsletter(obj1);
2066                                    break;
2067                }
2068            }
2069                            if (newObject)
2070            {
2071                obj5.initNewsletters();
2072                obj5.addNewsletter(obj1);
2073            }
2074                                                                                    
2075                                                                        
2076                            
2077              
2078                           omClass = LanguagePeer.getOMClass();
2079                          Language obj6 = (Language)LanguagePeer
2080                .row2Object( row, offset6, omClass);
2081
2082               newObject = true;
2083            for (int j = 0; j < results.size(); j++)
2084            {
2085                Newsletter temp_obj1 = (Newsletter)results.get(j);
2086                Language temp_obj6 = (Language)temp_obj1.getLanguageRelatedByCustLanguageId();
2087                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2088                {
2089                    newObject = false;
2090                                    temp_obj6.addNewsletterRelatedByCustLanguageId(obj1);
2091                                    break;
2092                }
2093            }
2094                            if (newObject)
2095            {
2096                obj6.initNewslettersRelatedByCustLanguageId();
2097                obj6.addNewsletterRelatedByCustLanguageId(obj1);
2098            }
2099                                                                                    
2100                                                                        
2101                            
2102              
2103                           omClass = LanguagePeer.getOMClass();
2104                          Language obj7 = (Language)LanguagePeer
2105                .row2Object( row, offset7, omClass);
2106
2107               newObject = true;
2108            for (int j = 0; j < results.size(); j++)
2109            {
2110                Newsletter temp_obj1 = (Newsletter)results.get(j);
2111                Language temp_obj7 = (Language)temp_obj1.getLanguageRelatedByLanguageId();
2112                if (temp_obj7.getPrimaryKey().equals(obj7.getPrimaryKey()))
2113                {
2114                    newObject = false;
2115                                    temp_obj7.addNewsletterRelatedByLanguageId(obj1);
2116                                    break;
2117                }
2118            }
2119                            if (newObject)
2120            {
2121                obj7.initNewslettersRelatedByLanguageId();
2122                obj7.addNewsletterRelatedByLanguageId(obj1);
2123            }
2124                                                                results.add(obj1);
2125        }
2126        return results;
2127    }
2128        
2129        
2130                                            
2131                
2132
2133    /**
2134     * selects a collection of Newsletter objects pre-filled with
2135     * all related objects.
2136     *
2137     * This method is protected by default in order to keep the public
2138     * api reasonable. You can provide public methods for those you
2139     * actually need in NewsletterPeer.
2140     *
2141     * @throws TorqueException Any exceptions caught during processing will be
2142     * rethrown wrapped into a TorqueException.
2143     */

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

2354    protected static List JavaDoc doSelectJoinAllExceptProductRelatedByRelProductId(Criteria criteria)
2355        throws TorqueException
2356    {
2357        setDbName(criteria);
2358
2359        addSelectColumns(criteria);
2360        int offset2 = numColumns + 1;
2361                                    
2362                    CustomerCategoryPeer.addSelectColumns(criteria);
2363        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
2364                                                                
2365                    ProjectPeer.addSelectColumns(criteria);
2366        int offset4 = offset3 + ProjectPeer.numColumns;
2367                                                                
2368                                                  
2369                    ProjectPeer.addSelectColumns(criteria);
2370        int offset5 = offset4 + ProjectPeer.numColumns;
2371                                                                
2372                                                  
2373                    CountryPeer.addSelectColumns(criteria);
2374        int offset6 = offset5 + CountryPeer.numColumns;
2375                                                                
2376                    LanguagePeer.addSelectColumns(criteria);
2377        int offset7 = offset6 + LanguagePeer.numColumns;
2378                                                                
2379                    LanguagePeer.addSelectColumns(criteria);
2380        int offset8 = offset7 + LanguagePeer.numColumns;
2381                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
2382        List JavaDoc rows = BasePeer.doSelect(criteria);
2383        List JavaDoc results = new ArrayList JavaDoc();
2384
2385        for (int i = 0; i < rows.size(); i++)
2386        {
2387            Record row = (Record)rows.get(i);
2388
2389                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
2390                    Newsletter obj1 = (Newsletter)NewsletterPeer
2391                .row2Object(row, 1, omClass);
2392                                                
2393                                                        
2394                            
2395              
2396                           omClass = CustomerCategoryPeer.getOMClass();
2397                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
2398                .row2Object( row, offset2, omClass);
2399
2400               boolean newObject = true;
2401            for (int j = 0; j < results.size(); j++)
2402            {
2403                Newsletter temp_obj1 = (Newsletter)results.get(j);
2404                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
2405                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2406                {
2407                    newObject = false;
2408                                    temp_obj2.addNewsletter(obj1);
2409                                    break;
2410                }
2411            }
2412                            if (newObject)
2413            {
2414                obj2.initNewsletters();
2415                obj2.addNewsletter(obj1);
2416            }
2417                                                                                    
2418                                                                        
2419                            
2420              
2421                           omClass = ProjectPeer.getOMClass();
2422                          Project obj3 = (Project)ProjectPeer
2423                .row2Object( row, offset3, omClass);
2424
2425               newObject = true;
2426            for (int j = 0; j < results.size(); j++)
2427            {
2428                Newsletter temp_obj1 = (Newsletter)results.get(j);
2429                Project temp_obj3 = (Project)temp_obj1.getProjectRelatedByProjectId();
2430                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2431                {
2432                    newObject = false;
2433                                    temp_obj3.addNewsletterRelatedByProjectId(obj1);
2434                                    break;
2435                }
2436            }
2437                            if (newObject)
2438            {
2439                obj3.initNewslettersRelatedByProjectId();
2440                obj3.addNewsletterRelatedByProjectId(obj1);
2441            }
2442                                                                                    
2443                                                                  
2444                                                                        
2445                            
2446              
2447                           omClass = ProjectPeer.getOMClass();
2448                          Project obj4 = (Project)ProjectPeer
2449                .row2Object( row, offset4, omClass);
2450
2451               newObject = true;
2452            for (int j = 0; j < results.size(); j++)
2453            {
2454                Newsletter temp_obj1 = (Newsletter)results.get(j);
2455                Project temp_obj4 = (Project)temp_obj1.getProjectRelatedByRelProjectId();
2456                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2457                {
2458                    newObject = false;
2459                                    temp_obj4.addNewsletterRelatedByRelProjectId(obj1);
2460                                    break;
2461                }
2462            }
2463                            if (newObject)
2464            {
2465                obj4.initNewslettersRelatedByRelProjectId();
2466                obj4.addNewsletterRelatedByRelProjectId(obj1);
2467            }
2468                                                                                    
2469                                                                  
2470                                                        
2471                            
2472              
2473                           omClass = CountryPeer.getOMClass();
2474                          Country obj5 = (Country)CountryPeer
2475                .row2Object( row, offset5, omClass);
2476
2477               newObject = true;
2478            for (int j = 0; j < results.size(); j++)
2479            {
2480                Newsletter temp_obj1 = (Newsletter)results.get(j);
2481                Country temp_obj5 = (Country)temp_obj1.getCountry();
2482                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2483                {
2484                    newObject = false;
2485                                    temp_obj5.addNewsletter(obj1);
2486                                    break;
2487                }
2488            }
2489                            if (newObject)
2490            {
2491                obj5.initNewsletters();
2492                obj5.addNewsletter(obj1);
2493            }
2494                                                                                    
2495                                                                        
2496                            
2497              
2498                           omClass = LanguagePeer.getOMClass();
2499                          Language obj6 = (Language)LanguagePeer
2500                .row2Object( row, offset6, omClass);
2501
2502               newObject = true;
2503            for (int j = 0; j < results.size(); j++)
2504            {
2505                Newsletter temp_obj1 = (Newsletter)results.get(j);
2506                Language temp_obj6 = (Language)temp_obj1.getLanguageRelatedByCustLanguageId();
2507                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2508                {
2509                    newObject = false;
2510                                    temp_obj6.addNewsletterRelatedByCustLanguageId(obj1);
2511                                    break;
2512                }
2513            }
2514                            if (newObject)
2515            {
2516                obj6.initNewslettersRelatedByCustLanguageId();
2517                obj6.addNewsletterRelatedByCustLanguageId(obj1);
2518            }
2519                                                                                    
2520                                                                        
2521                            
2522              
2523                           omClass = LanguagePeer.getOMClass();
2524                          Language obj7 = (Language)LanguagePeer
2525                .row2Object( row, offset7, omClass);
2526
2527               newObject = true;
2528            for (int j = 0; j < results.size(); j++)
2529            {
2530                Newsletter temp_obj1 = (Newsletter)results.get(j);
2531                Language temp_obj7 = (Language)temp_obj1.getLanguageRelatedByLanguageId();
2532                if (temp_obj7.getPrimaryKey().equals(obj7.getPrimaryKey()))
2533                {
2534                    newObject = false;
2535                                    temp_obj7.addNewsletterRelatedByLanguageId(obj1);
2536                                    break;
2537                }
2538            }
2539                            if (newObject)
2540            {
2541                obj7.initNewslettersRelatedByLanguageId();
2542                obj7.addNewsletterRelatedByLanguageId(obj1);
2543            }
2544                                                                results.add(obj1);
2545        }
2546        return results;
2547    }
2548        
2549        
2550                                  
2551                
2552
2553    /**
2554     * selects a collection of Newsletter objects pre-filled with
2555     * all related objects.
2556     *
2557     * This method is protected by default in order to keep the public
2558     * api reasonable. You can provide public methods for those you
2559     * actually need in NewsletterPeer.
2560     *
2561     * @throws TorqueException Any exceptions caught during processing will be
2562     * rethrown wrapped into a TorqueException.
2563     */

2564    protected static List JavaDoc doSelectJoinAllExceptCountry(Criteria criteria)
2565        throws TorqueException
2566    {
2567        setDbName(criteria);
2568
2569        addSelectColumns(criteria);
2570        int offset2 = numColumns + 1;
2571                                    
2572                    CustomerCategoryPeer.addSelectColumns(criteria);
2573        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
2574                                                                
2575                    ProjectPeer.addSelectColumns(criteria);
2576        int offset4 = offset3 + ProjectPeer.numColumns;
2577                                                                
2578                    ProductPeer.addSelectColumns(criteria);
2579        int offset5 = offset4 + ProductPeer.numColumns;
2580                                                                
2581                    ProjectPeer.addSelectColumns(criteria);
2582        int offset6 = offset5 + ProjectPeer.numColumns;
2583                                                                
2584                    ProductPeer.addSelectColumns(criteria);
2585        int offset7 = offset6 + ProductPeer.numColumns;
2586                                                                
2587                                                  
2588                    LanguagePeer.addSelectColumns(criteria);
2589        int offset8 = offset7 + LanguagePeer.numColumns;
2590                                                                
2591                    LanguagePeer.addSelectColumns(criteria);
2592        int offset9 = offset8 + LanguagePeer.numColumns;
2593                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        
2594        List JavaDoc rows = BasePeer.doSelect(criteria);
2595        List JavaDoc results = new ArrayList JavaDoc();
2596
2597        for (int i = 0; i < rows.size(); i++)
2598        {
2599            Record row = (Record)rows.get(i);
2600
2601                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
2602                    Newsletter obj1 = (Newsletter)NewsletterPeer
2603                .row2Object(row, 1, omClass);
2604                                                
2605                                                        
2606                            
2607              
2608                           omClass = CustomerCategoryPeer.getOMClass();
2609                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
2610                .row2Object( row, offset2, omClass);
2611
2612               boolean newObject = true;
2613            for (int j = 0; j < results.size(); j++)
2614            {
2615                Newsletter temp_obj1 = (Newsletter)results.get(j);
2616                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
2617                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2618                {
2619                    newObject = false;
2620                                    temp_obj2.addNewsletter(obj1);
2621                                    break;
2622                }
2623            }
2624                            if (newObject)
2625            {
2626                obj2.initNewsletters();
2627                obj2.addNewsletter(obj1);
2628            }
2629                                                                                    
2630                                                                        
2631                            
2632              
2633                           omClass = ProjectPeer.getOMClass();
2634                          Project obj3 = (Project)ProjectPeer
2635                .row2Object( row, offset3, omClass);
2636
2637               newObject = true;
2638            for (int j = 0; j < results.size(); j++)
2639            {
2640                Newsletter temp_obj1 = (Newsletter)results.get(j);
2641                Project temp_obj3 = (Project)temp_obj1.getProjectRelatedByProjectId();
2642                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2643                {
2644                    newObject = false;
2645                                    temp_obj3.addNewsletterRelatedByProjectId(obj1);
2646                                    break;
2647                }
2648            }
2649                            if (newObject)
2650            {
2651                obj3.initNewslettersRelatedByProjectId();
2652                obj3.addNewsletterRelatedByProjectId(obj1);
2653            }
2654                                                                                    
2655                                                                        
2656                            
2657              
2658                           omClass = ProductPeer.getOMClass();
2659                          Product obj4 = (Product)ProductPeer
2660                .row2Object( row, offset4, omClass);
2661
2662               newObject = true;
2663            for (int j = 0; j < results.size(); j++)
2664            {
2665                Newsletter temp_obj1 = (Newsletter)results.get(j);
2666                Product temp_obj4 = (Product)temp_obj1.getProductRelatedByProductId();
2667                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2668                {
2669                    newObject = false;
2670                                    temp_obj4.addNewsletterRelatedByProductId(obj1);
2671                                    break;
2672                }
2673            }
2674                            if (newObject)
2675            {
2676                obj4.initNewslettersRelatedByProductId();
2677                obj4.addNewsletterRelatedByProductId(obj1);
2678            }
2679                                                                                    
2680                                                                        
2681                            
2682              
2683                           omClass = ProjectPeer.getOMClass();
2684                          Project obj5 = (Project)ProjectPeer
2685                .row2Object( row, offset5, omClass);
2686
2687               newObject = true;
2688            for (int j = 0; j < results.size(); j++)
2689            {
2690                Newsletter temp_obj1 = (Newsletter)results.get(j);
2691                Project temp_obj5 = (Project)temp_obj1.getProjectRelatedByRelProjectId();
2692                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2693                {
2694                    newObject = false;
2695                                    temp_obj5.addNewsletterRelatedByRelProjectId(obj1);
2696                                    break;
2697                }
2698            }
2699                            if (newObject)
2700            {
2701                obj5.initNewslettersRelatedByRelProjectId();
2702                obj5.addNewsletterRelatedByRelProjectId(obj1);
2703            }
2704                                                                                    
2705                                                                        
2706                            
2707              
2708                           omClass = ProductPeer.getOMClass();
2709                          Product obj6 = (Product)ProductPeer
2710                .row2Object( row, offset6, omClass);
2711
2712               newObject = true;
2713            for (int j = 0; j < results.size(); j++)
2714            {
2715                Newsletter temp_obj1 = (Newsletter)results.get(j);
2716                Product temp_obj6 = (Product)temp_obj1.getProductRelatedByRelProductId();
2717                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2718                {
2719                    newObject = false;
2720                                    temp_obj6.addNewsletterRelatedByRelProductId(obj1);
2721                                    break;
2722                }
2723            }
2724                            if (newObject)
2725            {
2726                obj6.initNewslettersRelatedByRelProductId();
2727                obj6.addNewsletterRelatedByRelProductId(obj1);
2728            }
2729                                                                                    
2730                                                                  
2731                                                                        
2732                            
2733              
2734                           omClass = LanguagePeer.getOMClass();
2735                          Language obj7 = (Language)LanguagePeer
2736                .row2Object( row, offset7, omClass);
2737
2738               newObject = true;
2739            for (int j = 0; j < results.size(); j++)
2740            {
2741                Newsletter temp_obj1 = (Newsletter)results.get(j);
2742                Language temp_obj7 = (Language)temp_obj1.getLanguageRelatedByCustLanguageId();
2743                if (temp_obj7.getPrimaryKey().equals(obj7.getPrimaryKey()))
2744                {
2745                    newObject = false;
2746                                    temp_obj7.addNewsletterRelatedByCustLanguageId(obj1);
2747                                    break;
2748                }
2749            }
2750                            if (newObject)
2751            {
2752                obj7.initNewslettersRelatedByCustLanguageId();
2753                obj7.addNewsletterRelatedByCustLanguageId(obj1);
2754            }
2755                                                                                    
2756                                                                        
2757                            
2758              
2759                           omClass = LanguagePeer.getOMClass();
2760                          Language obj8 = (Language)LanguagePeer
2761                .row2Object( row, offset8, omClass);
2762
2763               newObject = true;
2764            for (int j = 0; j < results.size(); j++)
2765            {
2766                Newsletter temp_obj1 = (Newsletter)results.get(j);
2767                Language temp_obj8 = (Language)temp_obj1.getLanguageRelatedByLanguageId();
2768                if (temp_obj8.getPrimaryKey().equals(obj8.getPrimaryKey()))
2769                {
2770                    newObject = false;
2771                                    temp_obj8.addNewsletterRelatedByLanguageId(obj1);
2772                                    break;
2773                }
2774            }
2775                            if (newObject)
2776            {
2777                obj8.initNewslettersRelatedByLanguageId();
2778                obj8.addNewsletterRelatedByLanguageId(obj1);
2779            }
2780                                                                results.add(obj1);
2781        }
2782        return results;
2783    }
2784        
2785        
2786                                            
2787                
2788
2789    /**
2790     * selects a collection of Newsletter objects pre-filled with
2791     * all related objects.
2792     *
2793     * This method is protected by default in order to keep the public
2794     * api reasonable. You can provide public methods for those you
2795     * actually need in NewsletterPeer.
2796     *
2797     * @throws TorqueException Any exceptions caught during processing will be
2798     * rethrown wrapped into a TorqueException.
2799     */

2800    protected static List JavaDoc doSelectJoinAllExceptLanguageRelatedByCustLanguageId(Criteria criteria)
2801        throws TorqueException
2802    {
2803        setDbName(criteria);
2804
2805        addSelectColumns(criteria);
2806        int offset2 = numColumns + 1;
2807                                    
2808                    CustomerCategoryPeer.addSelectColumns(criteria);
2809        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
2810                                                                
2811                    ProjectPeer.addSelectColumns(criteria);
2812        int offset4 = offset3 + ProjectPeer.numColumns;
2813                                                                
2814                    ProductPeer.addSelectColumns(criteria);
2815        int offset5 = offset4 + ProductPeer.numColumns;
2816                                                                
2817                    ProjectPeer.addSelectColumns(criteria);
2818        int offset6 = offset5 + ProjectPeer.numColumns;
2819                                                                
2820                    ProductPeer.addSelectColumns(criteria);
2821        int offset7 = offset6 + ProductPeer.numColumns;
2822                                                                
2823                    CountryPeer.addSelectColumns(criteria);
2824        int offset8 = offset7 + CountryPeer.numColumns;
2825                                                                
2826                                                  
2827                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
2828        List JavaDoc rows = BasePeer.doSelect(criteria);
2829        List JavaDoc results = new ArrayList JavaDoc();
2830
2831        for (int i = 0; i < rows.size(); i++)
2832        {
2833            Record row = (Record)rows.get(i);
2834
2835                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
2836                    Newsletter obj1 = (Newsletter)NewsletterPeer
2837                .row2Object(row, 1, omClass);
2838                                                
2839                                                        
2840                            
2841              
2842                           omClass = CustomerCategoryPeer.getOMClass();
2843                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
2844                .row2Object( row, offset2, omClass);
2845
2846               boolean newObject = true;
2847            for (int j = 0; j < results.size(); j++)
2848            {
2849                Newsletter temp_obj1 = (Newsletter)results.get(j);
2850                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
2851                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2852                {
2853                    newObject = false;
2854                                    temp_obj2.addNewsletter(obj1);
2855                                    break;
2856                }
2857            }
2858                            if (newObject)
2859            {
2860                obj2.initNewsletters();
2861                obj2.addNewsletter(obj1);
2862            }
2863                                                                                    
2864                                                                        
2865                            
2866              
2867                           omClass = ProjectPeer.getOMClass();
2868                          Project obj3 = (Project)ProjectPeer
2869                .row2Object( row, offset3, omClass);
2870
2871               newObject = true;
2872            for (int j = 0; j < results.size(); j++)
2873            {
2874                Newsletter temp_obj1 = (Newsletter)results.get(j);
2875                Project temp_obj3 = (Project)temp_obj1.getProjectRelatedByProjectId();
2876                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2877                {
2878                    newObject = false;
2879                                    temp_obj3.addNewsletterRelatedByProjectId(obj1);
2880                                    break;
2881                }
2882            }
2883                            if (newObject)
2884            {
2885                obj3.initNewslettersRelatedByProjectId();
2886                obj3.addNewsletterRelatedByProjectId(obj1);
2887            }
2888                                                                                    
2889                                                                        
2890                            
2891              
2892                           omClass = ProductPeer.getOMClass();
2893                          Product obj4 = (Product)ProductPeer
2894                .row2Object( row, offset4, omClass);
2895
2896               newObject = true;
2897            for (int j = 0; j < results.size(); j++)
2898            {
2899                Newsletter temp_obj1 = (Newsletter)results.get(j);
2900                Product temp_obj4 = (Product)temp_obj1.getProductRelatedByProductId();
2901                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2902                {
2903                    newObject = false;
2904                                    temp_obj4.addNewsletterRelatedByProductId(obj1);
2905                                    break;
2906                }
2907            }
2908                            if (newObject)
2909            {
2910                obj4.initNewslettersRelatedByProductId();
2911                obj4.addNewsletterRelatedByProductId(obj1);
2912            }
2913                                                                                    
2914                                                                        
2915                            
2916              
2917                           omClass = ProjectPeer.getOMClass();
2918                          Project obj5 = (Project)ProjectPeer
2919                .row2Object( row, offset5, omClass);
2920
2921               newObject = true;
2922            for (int j = 0; j < results.size(); j++)
2923            {
2924                Newsletter temp_obj1 = (Newsletter)results.get(j);
2925                Project temp_obj5 = (Project)temp_obj1.getProjectRelatedByRelProjectId();
2926                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2927                {
2928                    newObject = false;
2929                                    temp_obj5.addNewsletterRelatedByRelProjectId(obj1);
2930                                    break;
2931                }
2932            }
2933                            if (newObject)
2934            {
2935                obj5.initNewslettersRelatedByRelProjectId();
2936                obj5.addNewsletterRelatedByRelProjectId(obj1);
2937            }
2938                                                                                    
2939                                                                        
2940                            
2941              
2942                           omClass = ProductPeer.getOMClass();
2943                          Product obj6 = (Product)ProductPeer
2944                .row2Object( row, offset6, omClass);
2945
2946               newObject = true;
2947            for (int j = 0; j < results.size(); j++)
2948            {
2949                Newsletter temp_obj1 = (Newsletter)results.get(j);
2950                Product temp_obj6 = (Product)temp_obj1.getProductRelatedByRelProductId();
2951                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2952                {
2953                    newObject = false;
2954                                    temp_obj6.addNewsletterRelatedByRelProductId(obj1);
2955                                    break;
2956                }
2957            }
2958                            if (newObject)
2959            {
2960                obj6.initNewslettersRelatedByRelProductId();
2961                obj6.addNewsletterRelatedByRelProductId(obj1);
2962            }
2963                                                                                    
2964                                                        
2965                            
2966              
2967                           omClass = CountryPeer.getOMClass();
2968                          Country obj7 = (Country)CountryPeer
2969                .row2Object( row, offset7, omClass);
2970
2971               newObject = true;
2972            for (int j = 0; j < results.size(); j++)
2973            {
2974                Newsletter temp_obj1 = (Newsletter)results.get(j);
2975                Country temp_obj7 = (Country)temp_obj1.getCountry();
2976                if (temp_obj7.getPrimaryKey().equals(obj7.getPrimaryKey()))
2977                {
2978                    newObject = false;
2979                                    temp_obj7.addNewsletter(obj1);
2980                                    break;
2981                }
2982            }
2983                            if (newObject)
2984            {
2985                obj7.initNewsletters();
2986                obj7.addNewsletter(obj1);
2987            }
2988                                                                                    
2989                                                                  
2990                                              results.add(obj1);
2991        }
2992        return results;
2993    }
2994        
2995        
2996                                            
2997                
2998
2999    /**
3000     * selects a collection of Newsletter objects pre-filled with
3001     * all related objects.
3002     *
3003     * This method is protected by default in order to keep the public
3004     * api reasonable. You can provide public methods for those you
3005     * actually need in NewsletterPeer.
3006     *
3007     * @throws TorqueException Any exceptions caught during processing will be
3008     * rethrown wrapped into a TorqueException.
3009     */

3010    protected static List JavaDoc doSelectJoinAllExceptLanguageRelatedByLanguageId(Criteria criteria)
3011        throws TorqueException
3012    {
3013        setDbName(criteria);
3014
3015        addSelectColumns(criteria);
3016        int offset2 = numColumns + 1;
3017                                    
3018                    CustomerCategoryPeer.addSelectColumns(criteria);
3019        int offset3 = offset2 + CustomerCategoryPeer.numColumns;
3020                                                                
3021                    ProjectPeer.addSelectColumns(criteria);
3022        int offset4 = offset3 + ProjectPeer.numColumns;
3023                                                                
3024                    ProductPeer.addSelectColumns(criteria);
3025        int offset5 = offset4 + ProductPeer.numColumns;
3026                                                                
3027                    ProjectPeer.addSelectColumns(criteria);
3028        int offset6 = offset5 + ProjectPeer.numColumns;
3029                                                                
3030                    ProductPeer.addSelectColumns(criteria);
3031        int offset7 = offset6 + ProductPeer.numColumns;
3032                                                                
3033                    CountryPeer.addSelectColumns(criteria);
3034        int offset8 = offset7 + CountryPeer.numColumns;
3035                                                                
3036                                                  
3037                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
3038        List JavaDoc rows = BasePeer.doSelect(criteria);
3039        List JavaDoc results = new ArrayList JavaDoc();
3040
3041        for (int i = 0; i < rows.size(); i++)
3042        {
3043            Record row = (Record)rows.get(i);
3044
3045                            Class JavaDoc omClass = NewsletterPeer.getOMClass();
3046                    Newsletter obj1 = (Newsletter)NewsletterPeer
3047                .row2Object(row, 1, omClass);
3048                                                
3049                                                        
3050                            
3051              
3052                           omClass = CustomerCategoryPeer.getOMClass();
3053                          CustomerCategory obj2 = (CustomerCategory)CustomerCategoryPeer
3054                .row2Object( row, offset2, omClass);
3055
3056               boolean newObject = true;
3057            for (int j = 0; j < results.size(); j++)
3058            {
3059                Newsletter temp_obj1 = (Newsletter)results.get(j);
3060                CustomerCategory temp_obj2 = (CustomerCategory)temp_obj1.getCustomerCategory();
3061                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
3062                {
3063                    newObject = false;
3064                                    temp_obj2.addNewsletter(obj1);
3065                                    break;
3066                }
3067            }
3068                            if (newObject)
3069            {
3070                obj2.initNewsletters();
3071                obj2.addNewsletter(obj1);
3072            }
3073                                                                                    
3074                                                                        
3075                            
3076              
3077                           omClass = ProjectPeer.getOMClass();
3078                          Project obj3 = (Project)ProjectPeer
3079                .row2Object( row, offset3, omClass);
3080
3081               newObject = true;
3082            for (int j = 0; j < results.size(); j++)
3083            {
3084                Newsletter temp_obj1 = (Newsletter)results.get(j);
3085                Project temp_obj3 = (Project)temp_obj1.getProjectRelatedByProjectId();
3086                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
3087                {
3088                    newObject = false;
3089                                    temp_obj3.addNewsletterRelatedByProjectId(obj1);
3090                                    break;
3091                }
3092            }
3093                            if (newObject)
3094            {
3095                obj3.initNewslettersRelatedByProjectId();
3096                obj3.addNewsletterRelatedByProjectId(obj1);
3097            }
3098                                                                                    
3099                                                                        
3100                            
3101              
3102                           omClass = ProductPeer.getOMClass();
3103                          Product obj4 = (Product)ProductPeer
3104                .row2Object( row, offset4, omClass);
3105
3106               newObject = true;
3107            for (int j = 0; j < results.size(); j++)
3108            {
3109                Newsletter temp_obj1 = (Newsletter)results.get(j);
3110                Product temp_obj4 = (Product)temp_obj1.getProductRelatedByProductId();
3111                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
3112                {
3113                    newObject = false;
3114                                    temp_obj4.addNewsletterRelatedByProductId(obj1);
3115                                    break;
3116                }
3117            }
3118                            if (newObject)
3119            {
3120                obj4.initNewslettersRelatedByProductId();
3121                obj4.addNewsletterRelatedByProductId(obj1);
3122            }
3123                                                                                    
3124                                                                        
3125                            
3126              
3127                           omClass = ProjectPeer.getOMClass();
3128                          Project obj5 = (Project)ProjectPeer
3129                .row2Object( row, offset5, omClass);
3130
3131               newObject = true;
3132            for (int j = 0; j < results.size(); j++)
3133            {
3134                Newsletter temp_obj1 = (Newsletter)results.get(j);
3135                Project temp_obj5 = (Project)temp_obj1.getProjectRelatedByRelProjectId();
3136                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
3137                {
3138                    newObject = false;
3139                                    temp_obj5.addNewsletterRelatedByRelProjectId(obj1);
3140                                    break;
3141                }
3142            }
3143                            if (newObject)
3144            {
3145                obj5.initNewslettersRelatedByRelProjectId();
3146                obj5.addNewsletterRelatedByRelProjectId(obj1);
3147            }
3148                                                                                    
3149                                                                        
3150                            
3151              
3152                           omClass = ProductPeer.getOMClass();
3153                          Product obj6 = (Product)ProductPeer
3154                .row2Object( row, offset6, omClass);
3155
3156               newObject = true;
3157            for (int j = 0; j < results.size(); j++)
3158            {
3159                Newsletter temp_obj1 = (Newsletter)results.get(j);
3160                Product temp_obj6 = (Product)temp_obj1.getProductRelatedByRelProductId();
3161                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
3162                {
3163                    newObject = false;
3164                                    temp_obj6.addNewsletterRelatedByRelProductId(obj1);
3165                                    break;
3166                }
3167            }
3168                            if (newObject)
3169            {
3170                obj6.initNewslettersRelatedByRelProductId();
3171                obj6.addNewsletterRelatedByRelProductId(obj1);
3172            }
3173                                                                                    
3174                                                        
3175                            
3176              
3177                           omClass = CountryPeer.getOMClass();
3178                          Country obj7 = (Country)CountryPeer
3179                .row2Object( row, offset7, omClass);
3180
3181               newObject = true;
3182            for (int j = 0; j < results.size(); j++)
3183            {
3184                Newsletter temp_obj1 = (Newsletter)results.get(j);
3185                Country temp_obj7 = (Country)temp_obj1.getCountry();
3186                if (temp_obj7.getPrimaryKey().equals(obj7.getPrimaryKey()))
3187                {
3188                    newObject = false;
3189                                    temp_obj7.addNewsletter(obj1);
3190                                    break;
3191                }
3192            }
3193                            if (newObject)
3194            {
3195                obj7.initNewsletters();
3196                obj7.addNewsletter(obj1);
3197            }
3198                                                                                    
3199                                                                  
3200                                              results.add(obj1);
3201        }
3202        return results;
3203    }
3204                    
3205  
3206      /**
3207     * Returns the TableMap related to this peer. This method is not
3208     * needed for general use but a specific application could have a need.
3209     *
3210     * @throws TorqueException Any exceptions caught during processing will be
3211     * rethrown wrapped into a TorqueException.
3212     */

3213    protected static TableMap getTableMap()
3214        throws TorqueException
3215    {
3216        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
3217    }
3218   
3219    private static void setDbName(Criteria crit)
3220    {
3221        // Set the correct dbName if it has not been overridden
3222
// crit.getDbName will return the same object if not set to
3223
// another value so == check is okay and faster
3224
if (crit.getDbName() == Torque.getDefaultDB())
3225        {
3226            crit.setDbName(DATABASE_NAME);
3227        }
3228    }
3229}
3230
Popular Tags