KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.campware.cream.om;
2
3 import java.math.BigDecimal JavaDoc;
4 import java.sql.Connection JavaDoc;
5 import java.sql.SQLException JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.util.Date JavaDoc;
8 import java.util.Iterator JavaDoc;
9 import java.util.LinkedList JavaDoc;
10 import java.util.List JavaDoc;
11
12 import org.apache.torque.NoRowsException;
13 import org.apache.torque.TooManyRowsException;
14 import org.apache.torque.Torque;
15 import org.apache.torque.TorqueException;
16 import org.apache.torque.map.MapBuilder;
17 import org.apache.torque.map.TableMap;
18 import org.apache.torque.om.DateKey;
19 import org.apache.torque.om.NumberKey;
20 import org.apache.torque.om.StringKey;
21 import org.apache.torque.om.ObjectKey;
22 import org.apache.torque.om.SimpleKey;
23 import org.apache.torque.util.BasePeer;
24 import org.apache.torque.util.Criteria;
25
26 import com.workingdogs.village.DataSetException;
27 import com.workingdogs.village.QueryDataSet;
28 import com.workingdogs.village.Record;
29
30 // Local classes
31
import org.campware.cream.om.map.*;
32
33
34   
35   
36   
37   
38   
39   
40 /**
41  * This class was autogenerated by Torque on:
42  *
43  * [Wed May 04 09:10:56 CEST 2005]
44  *
45  */

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

61     public static MapBuilder getMapBuilder()
62         throws TorqueException
63     {
64         return getMapBuilder(SorderItemMapBuilder.CLASS_NAME);
65     }
66
67       /** the column name for the SORDER_ITEM_ID field */
68     public static final String JavaDoc SORDER_ITEM_ID;
69       /** the column name for the SORDER_ID field */
70     public static final String JavaDoc SORDER_ID;
71       /** the column name for the CUSTOMER_ID field */
72     public static final String JavaDoc CUSTOMER_ID;
73       /** the column name for the RECIPIENT_ID field */
74     public static final String JavaDoc RECIPIENT_ID;
75       /** the column name for the PROJECT_ID field */
76     public static final String JavaDoc PROJECT_ID;
77       /** the column name for the PRODUCT_ID field */
78     public static final String JavaDoc PRODUCT_ID;
79       /** the column name for the DESCRIPTION field */
80     public static final String JavaDoc DESCRIPTION;
81       /** the column name for the UNIT_PRICE field */
82     public static final String JavaDoc UNIT_PRICE;
83       /** the column name for the CURRENCY_ID field */
84     public static final String JavaDoc CURRENCY_ID;
85       /** the column name for the QUANTITY field */
86     public static final String JavaDoc QUANTITY;
87       /** the column name for the ITEM_CURR_TOTAL field */
88     public static final String JavaDoc ITEM_CURR_TOTAL;
89   
90     static
91     {
92           SORDER_ITEM_ID = "SORDER_ITEM.SORDER_ITEM_ID";
93           SORDER_ID = "SORDER_ITEM.SORDER_ID";
94           CUSTOMER_ID = "SORDER_ITEM.CUSTOMER_ID";
95           RECIPIENT_ID = "SORDER_ITEM.RECIPIENT_ID";
96           PROJECT_ID = "SORDER_ITEM.PROJECT_ID";
97           PRODUCT_ID = "SORDER_ITEM.PRODUCT_ID";
98           DESCRIPTION = "SORDER_ITEM.DESCRIPTION";
99           UNIT_PRICE = "SORDER_ITEM.UNIT_PRICE";
100           CURRENCY_ID = "SORDER_ITEM.CURRENCY_ID";
101           QUANTITY = "SORDER_ITEM.QUANTITY";
102           ITEM_CURR_TOTAL = "SORDER_ITEM.ITEM_CURR_TOTAL";
103           if (Torque.isInit())
104         {
105             try
106             {
107                 getMapBuilder(SorderItemMapBuilder.CLASS_NAME);
108             }
109             catch (Exception JavaDoc e)
110             {
111                 log.error("Could not initialize Peer", e);
112             }
113         }
114         else
115         {
116             Torque.registerMapBuilder(SorderItemMapBuilder.CLASS_NAME);
117         }
118     }
119  
120     /** number of columns for this peer */
121     public static final int numColumns = 11;
122
123     /** A class that can be returned by this peer. */
124     protected static final String JavaDoc CLASSNAME_DEFAULT =
125         "org.campware.cream.om.SorderItem";
126
127     /** A class that can be returned by this peer. */
128     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
129
130     /**
131      * Class object initialization method.
132      *
133      * @param className name of the class to initialize
134      * @return the initialized class
135      */

136     private static Class JavaDoc initClass(String JavaDoc className)
137     {
138         Class JavaDoc c = null;
139         try
140         {
141             c = Class.forName(className);
142         }
143         catch (Throwable JavaDoc t)
144         {
145             log.error("A FATAL ERROR has occurred which should not "
146                 + "have happened under any circumstance. Please notify "
147                 + "the Torque developers <torque-dev@db.apache.org> "
148                 + "and give as many details as possible (including the error "
149                 + "stack trace).", t);
150
151             // Error objects should always be propogated.
152
if (t instanceof Error JavaDoc)
153             {
154                 throw (Error JavaDoc) t.fillInStackTrace();
155             }
156         }
157         return c;
158     }
159
160     /**
161      * Get the list of objects for a ResultSet. Please not that your
162      * resultset MUST return columns in the right order. You can use
163      * getFieldNames() in BaseObject to get the correct sequence.
164      *
165      * @param results the ResultSet
166      * @return the list of objects
167      * @throws TorqueException Any exceptions caught during processing will be
168      * rethrown wrapped into a TorqueException.
169      */

170     public static List JavaDoc resultSet2Objects(java.sql.ResultSet JavaDoc results)
171             throws TorqueException
172     {
173         try
174         {
175             QueryDataSet qds = null;
176             List JavaDoc rows = null;
177             try
178             {
179                 qds = new QueryDataSet(results);
180                 rows = getSelectResults(qds);
181             }
182             finally
183             {
184                 if (qds != null)
185                 {
186                     qds.close();
187                 }
188             }
189
190             return populateObjects(rows);
191         }
192         catch (SQLException JavaDoc e)
193         {
194             throw new TorqueException(e);
195         }
196         catch (DataSetException e)
197         {
198             throw new TorqueException(e);
199         }
200     }
201
202
203   
204     /**
205      * Method to do inserts.
206      *
207      * @param criteria object used to create the INSERT statement.
208      * @throws TorqueException Any exceptions caught during processing will be
209      * rethrown wrapped into a TorqueException.
210      */

211     public static ObjectKey doInsert(Criteria criteria)
212         throws TorqueException
213     {
214         return BaseSorderItemPeer
215             .doInsert(criteria, (Connection JavaDoc) null);
216     }
217
218     /**
219      * Method to do inserts. This method is to be used during a transaction,
220      * otherwise use the doInsert(Criteria) method. It will take care of
221      * the connection details internally.
222      *
223      * @param criteria object used to create the INSERT statement.
224      * @param con the connection to use
225      * @throws TorqueException Any exceptions caught during processing will be
226      * rethrown wrapped into a TorqueException.
227      */

228     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
229         throws TorqueException
230     {
231                                                                     
232         setDbName(criteria);
233
234         if (con == null)
235         {
236             return BasePeer.doInsert(criteria);
237         }
238         else
239         {
240             return BasePeer.doInsert(criteria, con);
241         }
242     }
243
244     /**
245      * Add all the columns needed to create a new object.
246      *
247      * @param criteria object containing the columns to add.
248      * @throws TorqueException Any exceptions caught during processing will be
249      * rethrown wrapped into a TorqueException.
250      */

251     public static void addSelectColumns(Criteria criteria)
252             throws TorqueException
253     {
254           criteria.addSelectColumn(SORDER_ITEM_ID);
255           criteria.addSelectColumn(SORDER_ID);
256           criteria.addSelectColumn(CUSTOMER_ID);
257           criteria.addSelectColumn(RECIPIENT_ID);
258           criteria.addSelectColumn(PROJECT_ID);
259           criteria.addSelectColumn(PRODUCT_ID);
260           criteria.addSelectColumn(DESCRIPTION);
261           criteria.addSelectColumn(UNIT_PRICE);
262           criteria.addSelectColumn(CURRENCY_ID);
263           criteria.addSelectColumn(QUANTITY);
264           criteria.addSelectColumn(ITEM_CURR_TOTAL);
265       }
266
267     /**
268      * Create a new object of type cls from a resultset row starting
269      * from a specified offset. This is done so that you can select
270      * other rows than just those needed for this object. You may
271      * for example want to create two objects from the same row.
272      *
273      * @throws TorqueException Any exceptions caught during processing will be
274      * rethrown wrapped into a TorqueException.
275      */

276     public static SorderItem row2Object(Record row,
277                                              int offset,
278                                              Class JavaDoc cls)
279         throws TorqueException
280     {
281         try
282         {
283             SorderItem obj = (SorderItem) cls.newInstance();
284             SorderItemPeer.populateObject(row, offset, obj);
285                   obj.setModified(false);
286               obj.setNew(false);
287
288             return obj;
289         }
290         catch (InstantiationException JavaDoc e)
291         {
292             throw new TorqueException(e);
293         }
294         catch (IllegalAccessException JavaDoc e)
295         {
296             throw new TorqueException(e);
297         }
298     }
299
300     /**
301      * Populates an object from a resultset row starting
302      * from a specified offset. This is done so that you can select
303      * other rows than just those needed for this object. You may
304      * for example want to create two objects from the same row.
305      *
306      * @throws TorqueException Any exceptions caught during processing will be
307      * rethrown wrapped into a TorqueException.
308      */

309     public static void populateObject(Record row,
310                                       int offset,
311                                       SorderItem obj)
312         throws TorqueException
313     {
314         try
315         {
316                 obj.setSorderItemId(row.getValue(offset + 0).asInt());
317                   obj.setSorderId(row.getValue(offset + 1).asInt());
318                   obj.setCustomerId(row.getValue(offset + 2).asInt());
319                   obj.setRecipientId(row.getValue(offset + 3).asInt());
320                   obj.setProjectId(row.getValue(offset + 4).asInt());
321                   obj.setProductId(row.getValue(offset + 5).asInt());
322                   obj.setDescription(row.getValue(offset + 6).asString());
323                   obj.setUnitPrice(row.getValue(offset + 7).asBigDecimal());
324                   obj.setCurrencyId(row.getValue(offset + 8).asInt());
325                   obj.setQuantity(row.getValue(offset + 9).asInt());
326                   obj.setItemCurrTotal(row.getValue(offset + 10).asBigDecimal());
327               }
328         catch (DataSetException e)
329         {
330             throw new TorqueException(e);
331         }
332     }
333
334     /**
335      * Method to do selects.
336      *
337      * @param criteria object used to create the SELECT statement.
338      * @return List of selected Objects
339      * @throws TorqueException Any exceptions caught during processing will be
340      * rethrown wrapped into a TorqueException.
341      */

342     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
343     {
344         return populateObjects(doSelectVillageRecords(criteria));
345     }
346
347     /**
348      * Method to do selects within a transaction.
349      *
350      * @param criteria object used to create the SELECT statement.
351      * @param con the connection to use
352      * @return List of selected Objects
353      * @throws TorqueException Any exceptions caught during processing will be
354      * rethrown wrapped into a TorqueException.
355      */

356     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
357         throws TorqueException
358     {
359         return populateObjects(doSelectVillageRecords(criteria, con));
360     }
361
362     /**
363      * Grabs the raw Village records to be formed into objects.
364      * This method handles connections internally. The Record objects
365      * returned by this method should be considered readonly. Do not
366      * alter the data and call save(), your results may vary, but are
367      * certainly likely to result in hard to track MT bugs.
368      *
369      * @throws TorqueException Any exceptions caught during processing will be
370      * rethrown wrapped into a TorqueException.
371      */

372     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
373         throws TorqueException
374     {
375         return BaseSorderItemPeer
376             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
377     }
378
379     /**
380      * Grabs the raw Village records to be formed into objects.
381      * This method should be used for transactions
382      *
383      * @param criteria object used to create the SELECT statement.
384      * @param con the connection to use
385      * @throws TorqueException Any exceptions caught during processing will be
386      * rethrown wrapped into a TorqueException.
387      */

388     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
389         throws TorqueException
390     {
391         if (criteria.getSelectColumns().size() == 0)
392         {
393             addSelectColumns(criteria);
394         }
395
396                                                                     
397         setDbName(criteria);
398
399         // BasePeer returns a List of Value (Village) arrays. The array
400
// order follows the order columns were placed in the Select clause.
401
if (con == null)
402         {
403             return BasePeer.doSelect(criteria);
404         }
405         else
406         {
407             return BasePeer.doSelect(criteria, con);
408         }
409     }
410
411     /**
412      * The returned List will contain objects of the default type or
413      * objects that inherit from the default.
414      *
415      * @throws TorqueException Any exceptions caught during processing will be
416      * rethrown wrapped into a TorqueException.
417      */

418     public static List JavaDoc populateObjects(List JavaDoc records)
419         throws TorqueException
420     {
421         List JavaDoc results = new ArrayList JavaDoc(records.size());
422
423         // populate the object(s)
424
for (int i = 0; i < records.size(); i++)
425         {
426             Record row = (Record) records.get(i);
427               results.add(SorderItemPeer.row2Object(row, 1,
428                 SorderItemPeer.getOMClass()));
429           }
430         return results;
431     }
432  
433
434     /**
435      * The class that the Peer will make instances of.
436      * If the BO is abstract then you must implement this method
437      * in the BO.
438      *
439      * @throws TorqueException Any exceptions caught during processing will be
440      * rethrown wrapped into a TorqueException.
441      */

442     public static Class JavaDoc getOMClass()
443         throws TorqueException
444     {
445         return CLASS_DEFAULT;
446     }
447
448     /**
449      * Method to do updates.
450      *
451      * @param criteria object containing data that is used to create the UPDATE
452      * statement.
453      * @throws TorqueException Any exceptions caught during processing will be
454      * rethrown wrapped into a TorqueException.
455      */

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

473     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
474         throws TorqueException
475     {
476         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
477                    selectCriteria.put(SORDER_ITEM_ID, criteria.remove(SORDER_ITEM_ID));
478                                                                                                           
479         setDbName(criteria);
480
481         if (con == null)
482         {
483             BasePeer.doUpdate(selectCriteria, criteria);
484         }
485         else
486         {
487             BasePeer.doUpdate(selectCriteria, criteria, con);
488         }
489     }
490
491     /**
492      * Method to do deletes.
493      *
494      * @param criteria object containing data that is used DELETE from database.
495      * @throws TorqueException Any exceptions caught during processing will be
496      * rethrown wrapped into a TorqueException.
497      */

498      public static void doDelete(Criteria criteria) throws TorqueException
499      {
500          SorderItemPeer
501             .doDelete(criteria, (Connection JavaDoc) null);
502      }
503
504     /**
505      * Method to do deletes. This method is to be used during a transaction,
506      * otherwise use the doDelete(Criteria) method. It will take care of
507      * the connection details internally.
508      *
509      * @param criteria object containing data that is used DELETE from database.
510      * @param con the connection to use
511      * @throws TorqueException Any exceptions caught during processing will be
512      * rethrown wrapped into a TorqueException.
513      */

514      public static void doDelete(Criteria criteria, Connection JavaDoc con)
515         throws TorqueException
516      {
517                                                                     
518         setDbName(criteria);
519
520         if (con == null)
521         {
522             BasePeer.doDelete(criteria);
523         }
524         else
525         {
526             BasePeer.doDelete(criteria, con);
527         }
528      }
529
530     /**
531      * Method to do selects
532      *
533      * @throws TorqueException Any exceptions caught during processing will be
534      * rethrown wrapped into a TorqueException.
535      */

536     public static List JavaDoc doSelect(SorderItem obj) throws TorqueException
537     {
538         return doSelect(buildSelectCriteria(obj));
539     }
540
541     /**
542      * Method to do inserts
543      *
544      * @throws TorqueException Any exceptions caught during processing will be
545      * rethrown wrapped into a TorqueException.
546      */

547     public static void doInsert(SorderItem obj) throws TorqueException
548     {
549           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
550           obj.setNew(false);
551         obj.setModified(false);
552     }
553
554     /**
555      * @param obj the data object to update in the database.
556      * @throws TorqueException Any exceptions caught during processing will be
557      * rethrown wrapped into a TorqueException.
558      */

559     public static void doUpdate(SorderItem obj) throws TorqueException
560     {
561         doUpdate(buildCriteria(obj));
562         obj.setModified(false);
563     }
564
565     /**
566      * @param obj the data object to delete in the database.
567      * @throws TorqueException Any exceptions caught during processing will be
568      * rethrown wrapped into a TorqueException.
569      */

570     public static void doDelete(SorderItem obj) throws TorqueException
571     {
572         doDelete(buildSelectCriteria(obj));
573     }
574
575     /**
576      * Method to do inserts. This method is to be used during a transaction,
577      * otherwise use the doInsert(SorderItem) method. It will take
578      * care of the connection details internally.
579      *
580      * @param obj the data object to insert into the database.
581      * @param con the connection to use
582      * @throws TorqueException Any exceptions caught during processing will be
583      * rethrown wrapped into a TorqueException.
584      */

585     public static void doInsert(SorderItem obj, Connection JavaDoc con)
586         throws TorqueException
587     {
588           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
589           obj.setNew(false);
590         obj.setModified(false);
591     }
592
593     /**
594      * Method to do update. This method is to be used during a transaction,
595      * otherwise use the doUpdate(SorderItem) method. It will take
596      * care of the connection details internally.
597      *
598      * @param obj the data object to update in the database.
599      * @param con the connection to use
600      * @throws TorqueException Any exceptions caught during processing will be
601      * rethrown wrapped into a TorqueException.
602      */

603     public static void doUpdate(SorderItem obj, Connection JavaDoc con)
604         throws TorqueException
605     {
606         doUpdate(buildCriteria(obj), con);
607         obj.setModified(false);
608     }
609
610     /**
611      * Method to delete. This method is to be used during a transaction,
612      * otherwise use the doDelete(SorderItem) method. It will take
613      * care of the connection details internally.
614      *
615      * @param obj the data object to delete in the database.
616      * @param con the connection to use
617      * @throws TorqueException Any exceptions caught during processing will be
618      * rethrown wrapped into a TorqueException.
619      */

620     public static void doDelete(SorderItem obj, Connection JavaDoc con)
621         throws TorqueException
622     {
623         doDelete(buildSelectCriteria(obj), con);
624     }
625
626     /**
627      * Method to do deletes.
628      *
629      * @param pk ObjectKey that is used DELETE from database.
630      * @throws TorqueException Any exceptions caught during processing will be
631      * rethrown wrapped into a TorqueException.
632      */

633     public static void doDelete(ObjectKey pk) throws TorqueException
634     {
635         BaseSorderItemPeer
636            .doDelete(pk, (Connection JavaDoc) null);
637     }
638
639     /**
640      * Method to delete. This method is to be used during a transaction,
641      * otherwise use the doDelete(ObjectKey) method. It will take
642      * care of the connection details internally.
643      *
644      * @param pk the primary key for the object to delete in the database.
645      * @param con the connection to use
646      * @throws TorqueException Any exceptions caught during processing will be
647      * rethrown wrapped into a TorqueException.
648      */

649     public static void doDelete(ObjectKey pk, Connection JavaDoc con)
650         throws TorqueException
651     {
652         doDelete(buildCriteria(pk), con);
653     }
654
655     /** Build a Criteria object from an ObjectKey */
656     public static Criteria buildCriteria( ObjectKey pk )
657     {
658         Criteria criteria = new Criteria();
659               criteria.add(SORDER_ITEM_ID, pk);
660           return criteria;
661      }
662
663     /** Build a Criteria object from the data object for this peer */
664     public static Criteria buildCriteria( SorderItem obj )
665     {
666         Criteria criteria = new Criteria(DATABASE_NAME);
667               if (!obj.isNew())
668             criteria.add(SORDER_ITEM_ID, obj.getSorderItemId());
669               criteria.add(SORDER_ID, obj.getSorderId());
670               criteria.add(CUSTOMER_ID, obj.getCustomerId());
671               criteria.add(RECIPIENT_ID, obj.getRecipientId());
672               criteria.add(PROJECT_ID, obj.getProjectId());
673               criteria.add(PRODUCT_ID, obj.getProductId());
674               criteria.add(DESCRIPTION, obj.getDescription());
675               criteria.add(UNIT_PRICE, obj.getUnitPrice());
676               criteria.add(CURRENCY_ID, obj.getCurrencyId());
677               criteria.add(QUANTITY, obj.getQuantity());
678               criteria.add(ITEM_CURR_TOTAL, obj.getItemCurrTotal());
679           return criteria;
680     }
681
682     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
683     public static Criteria buildSelectCriteria( SorderItem obj )
684     {
685         Criteria criteria = new Criteria(DATABASE_NAME);
686               if (!obj.isNew())
687                     criteria.add(SORDER_ITEM_ID, obj.getSorderItemId());
688                           criteria.add(SORDER_ID, obj.getSorderId());
689                           criteria.add(CUSTOMER_ID, obj.getCustomerId());
690                           criteria.add(RECIPIENT_ID, obj.getRecipientId());
691                           criteria.add(PROJECT_ID, obj.getProjectId());
692                           criteria.add(PRODUCT_ID, obj.getProductId());
693                           criteria.add(DESCRIPTION, obj.getDescription());
694                           criteria.add(UNIT_PRICE, obj.getUnitPrice());
695                           criteria.add(CURRENCY_ID, obj.getCurrencyId());
696                           criteria.add(QUANTITY, obj.getQuantity());
697                           criteria.add(ITEM_CURR_TOTAL, obj.getItemCurrTotal());
698               return criteria;
699     }
700  
701     
702         /**
703      * Retrieve a single object by pk
704      *
705      * @param pk the primary key
706      * @throws TorqueException Any exceptions caught during processing will be
707      * rethrown wrapped into a TorqueException.
708      * @throws NoRowsException Primary key was not found in database.
709      * @throws TooManyRowsException Primary key was not found in database.
710      */

711     public static SorderItem retrieveByPK(int pk)
712         throws TorqueException, NoRowsException, TooManyRowsException
713     {
714         return retrieveByPK(SimpleKey.keyFor(pk));
715     }
716
717     /**
718      * Retrieve a single object by pk
719      *
720      * @param pk the primary key
721      * @param con the connection to use
722      * @throws TorqueException Any exceptions caught during processing will be
723      * rethrown wrapped into a TorqueException.
724      * @throws NoRowsException Primary key was not found in database.
725      * @throws TooManyRowsException Primary key was not found in database.
726      */

727     public static SorderItem retrieveByPK(int pk, Connection JavaDoc con)
728         throws TorqueException, NoRowsException, TooManyRowsException
729     {
730         return retrieveByPK(SimpleKey.keyFor(pk), con);
731     }
732   
733     /**
734      * Retrieve a single object by pk
735      *
736      * @param pk the primary key
737      * @throws TorqueException Any exceptions caught during processing will be
738      * rethrown wrapped into a TorqueException.
739      * @throws NoRowsException Primary key was not found in database.
740      * @throws TooManyRowsException Primary key was not found in database.
741      */

742     public static SorderItem retrieveByPK(ObjectKey pk)
743         throws TorqueException, NoRowsException, TooManyRowsException
744     {
745         Connection JavaDoc db = null;
746         SorderItem retVal = null;
747         try
748         {
749             db = Torque.getConnection(DATABASE_NAME);
750             retVal = retrieveByPK(pk, db);
751         }
752         finally
753         {
754             Torque.closeConnection(db);
755         }
756         return(retVal);
757     }
758
759     /**
760      * Retrieve a single object by pk
761      *
762      * @param pk the primary key
763      * @param con the connection to use
764      * @throws TorqueException Any exceptions caught during processing will be
765      * rethrown wrapped into a TorqueException.
766      * @throws NoRowsException Primary key was not found in database.
767      * @throws TooManyRowsException Primary key was not found in database.
768      */

769     public static SorderItem retrieveByPK(ObjectKey pk, Connection JavaDoc con)
770         throws TorqueException, NoRowsException, TooManyRowsException
771     {
772         Criteria criteria = buildCriteria(pk);
773         List JavaDoc v = doSelect(criteria, con);
774         if (v.size() == 0)
775         {
776             throw new NoRowsException("Failed to select a row.");
777         }
778         else if (v.size() > 1)
779         {
780             throw new TooManyRowsException("Failed to select only one row.");
781         }
782         else
783         {
784             return (SorderItem)v.get(0);
785         }
786     }
787
788     /**
789      * Retrieve a multiple objects by pk
790      *
791      * @param pks List of primary keys
792      * @throws TorqueException Any exceptions caught during processing will be
793      * rethrown wrapped into a TorqueException.
794      */

795     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
796         throws TorqueException
797     {
798         Connection JavaDoc db = null;
799         List JavaDoc retVal = null;
800         try
801         {
802            db = Torque.getConnection(DATABASE_NAME);
803            retVal = retrieveByPKs(pks, db);
804         }
805         finally
806         {
807             Torque.closeConnection(db);
808         }
809         return(retVal);
810     }
811
812     /**
813      * Retrieve a multiple objects by pk
814      *
815      * @param pks List of primary keys
816      * @param dbcon the connection to use
817      * @throws TorqueException Any exceptions caught during processing will be
818      * rethrown wrapped into a TorqueException.
819      */

820     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
821         throws TorqueException
822     {
823         List JavaDoc objs = null;
824         if (pks == null || pks.size() == 0)
825         {
826             objs = new LinkedList JavaDoc();
827         }
828         else
829         {
830             Criteria criteria = new Criteria();
831               criteria.addIn( SORDER_ITEM_ID, pks );
832           objs = doSelect(criteria, dbcon);
833         }
834         return objs;
835     }
836
837  
838
839
840
841                     
842                                               
843                 
844                 
845
846     /**
847      * selects a collection of SorderItem objects pre-filled with their
848      * Sorder objects.
849      *
850      * This method is protected by default in order to keep the public
851      * api reasonable. You can provide public methods for those you
852      * actually need in SorderItemPeer.
853      *
854      * @throws TorqueException Any exceptions caught during processing will be
855      * rethrown wrapped into a TorqueException.
856      */

857     protected static List JavaDoc doSelectJoinSorder(Criteria criteria)
858         throws TorqueException
859     {
860         setDbName(criteria);
861
862         SorderItemPeer.addSelectColumns(criteria);
863         int offset = numColumns + 1;
864         SorderPeer.addSelectColumns(criteria);
865
866
867                         criteria.addJoin(SorderItemPeer.SORDER_ID,
868             SorderPeer.SORDER_ID);
869         
870
871                                                                                                                                                                                                               
872         List JavaDoc rows = BasePeer.doSelect(criteria);
873         List JavaDoc results = new ArrayList JavaDoc();
874
875         for (int i = 0; i < rows.size(); i++)
876         {
877             Record row = (Record) rows.get(i);
878
879                             Class JavaDoc omClass = SorderItemPeer.getOMClass();
880                     SorderItem obj1 = (SorderItem) SorderItemPeer
881                 .row2Object(row, 1, omClass);
882                      omClass = SorderPeer.getOMClass();
883                     Sorder obj2 = (Sorder)SorderPeer
884                 .row2Object(row, offset, omClass);
885
886             boolean newObject = true;
887             for (int j = 0; j < results.size(); j++)
888             {
889                 SorderItem temp_obj1 = (SorderItem)results.get(j);
890                 Sorder temp_obj2 = (Sorder)temp_obj1.getSorder();
891                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
892                 {
893                     newObject = false;
894                               temp_obj2.addSorderItem(obj1);
895                               break;
896                 }
897             }
898                       if (newObject)
899             {
900                 obj2.initSorderItems();
901                 obj2.addSorderItem(obj1);
902             }
903                       results.add(obj1);
904         }
905         return results;
906     }
907                                                             
908                 
909                 
910
911     /**
912      * selects a collection of SorderItem objects pre-filled with their
913      * Product objects.
914      *
915      * This method is protected by default in order to keep the public
916      * api reasonable. You can provide public methods for those you
917      * actually need in SorderItemPeer.
918      *
919      * @throws TorqueException Any exceptions caught during processing will be
920      * rethrown wrapped into a TorqueException.
921      */

922     protected static List JavaDoc doSelectJoinProduct(Criteria criteria)
923         throws TorqueException
924     {
925         setDbName(criteria);
926
927         SorderItemPeer.addSelectColumns(criteria);
928         int offset = numColumns + 1;
929         ProductPeer.addSelectColumns(criteria);
930
931
932                         criteria.addJoin(SorderItemPeer.PRODUCT_ID,
933             ProductPeer.PRODUCT_ID);
934         
935
936                                                                                                                                                                                                               
937         List JavaDoc rows = BasePeer.doSelect(criteria);
938         List JavaDoc results = new ArrayList JavaDoc();
939
940         for (int i = 0; i < rows.size(); i++)
941         {
942             Record row = (Record) rows.get(i);
943
944                             Class JavaDoc omClass = SorderItemPeer.getOMClass();
945                     SorderItem obj1 = (SorderItem) SorderItemPeer
946                 .row2Object(row, 1, omClass);
947                      omClass = ProductPeer.getOMClass();
948                     Product obj2 = (Product)ProductPeer
949                 .row2Object(row, offset, omClass);
950
951             boolean newObject = true;
952             for (int j = 0; j < results.size(); j++)
953             {
954                 SorderItem temp_obj1 = (SorderItem)results.get(j);
955                 Product temp_obj2 = (Product)temp_obj1.getProduct();
956                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
957                 {
958                     newObject = false;
959                               temp_obj2.addSorderItem(obj1);
960                               break;
961                 }
962             }
963                       if (newObject)
964             {
965                 obj2.initSorderItems();
966                 obj2.addSorderItem(obj1);
967             }
968                       results.add(obj1);
969         }
970         return results;
971     }
972                                                                       
973                 
974                 
975
976     /**
977      * selects a collection of SorderItem objects pre-filled with their
978      * Customer objects.
979      *
980      * This method is protected by default in order to keep the public
981      * api reasonable. You can provide public methods for those you
982      * actually need in SorderItemPeer.
983      *
984      * @throws TorqueException Any exceptions caught during processing will be
985      * rethrown wrapped into a TorqueException.
986      */

987     protected static List JavaDoc doSelectJoinCustomerRelatedByCustomerId(Criteria criteria)
988         throws TorqueException
989     {
990         setDbName(criteria);
991
992         SorderItemPeer.addSelectColumns(criteria);
993         int offset = numColumns + 1;
994         CustomerPeer.addSelectColumns(criteria);
995
996
997                         criteria.addJoin(SorderItemPeer.CUSTOMER_ID,
998             CustomerPeer.CUSTOMER_ID);
999         
1000
1001                                                                                                                                                                                                              
1002        List JavaDoc rows = BasePeer.doSelect(criteria);
1003        List JavaDoc results = new ArrayList JavaDoc();
1004
1005        for (int i = 0; i < rows.size(); i++)
1006        {
1007            Record row = (Record) rows.get(i);
1008
1009                            Class JavaDoc omClass = SorderItemPeer.getOMClass();
1010                    SorderItem obj1 = (SorderItem) SorderItemPeer
1011                .row2Object(row, 1, omClass);
1012                     omClass = CustomerPeer.getOMClass();
1013                    Customer obj2 = (Customer)CustomerPeer
1014                .row2Object(row, offset, omClass);
1015
1016            boolean newObject = true;
1017            for (int j = 0; j < results.size(); j++)
1018            {
1019                SorderItem temp_obj1 = (SorderItem)results.get(j);
1020                Customer temp_obj2 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1021                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1022                {
1023                    newObject = false;
1024                              temp_obj2.addSorderItemRelatedByCustomerId(obj1);
1025                              break;
1026                }
1027            }
1028                      if (newObject)
1029            {
1030                obj2.initSorderItemsRelatedByCustomerId();
1031                obj2.addSorderItemRelatedByCustomerId(obj1);
1032            }
1033                      results.add(obj1);
1034        }
1035        return results;
1036    }
1037                                                                      
1038                
1039                
1040
1041    /**
1042     * selects a collection of SorderItem objects pre-filled with their
1043     * Customer objects.
1044     *
1045     * This method is protected by default in order to keep the public
1046     * api reasonable. You can provide public methods for those you
1047     * actually need in SorderItemPeer.
1048     *
1049     * @throws TorqueException Any exceptions caught during processing will be
1050     * rethrown wrapped into a TorqueException.
1051     */

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

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

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

1251    protected static List JavaDoc doSelectJoinAllExceptSorder(Criteria criteria)
1252        throws TorqueException
1253    {
1254        setDbName(criteria);
1255
1256        addSelectColumns(criteria);
1257        int offset2 = numColumns + 1;
1258                                    
1259                                                  
1260                    ProductPeer.addSelectColumns(criteria);
1261        int offset3 = offset2 + ProductPeer.numColumns;
1262                                                                
1263                    CustomerPeer.addSelectColumns(criteria);
1264        int offset4 = offset3 + CustomerPeer.numColumns;
1265                                                                
1266                    CustomerPeer.addSelectColumns(criteria);
1267        int offset5 = offset4 + CustomerPeer.numColumns;
1268                                                                
1269                    ProjectPeer.addSelectColumns(criteria);
1270        int offset6 = offset5 + ProjectPeer.numColumns;
1271                                                                
1272                    CurrencyPeer.addSelectColumns(criteria);
1273        int offset7 = offset6 + CurrencyPeer.numColumns;
1274                                                                                                                                                                                                                                                          
1275        List JavaDoc rows = BasePeer.doSelect(criteria);
1276        List JavaDoc results = new ArrayList JavaDoc();
1277
1278        for (int i = 0; i < rows.size(); i++)
1279        {
1280            Record row = (Record)rows.get(i);
1281
1282                            Class JavaDoc omClass = SorderItemPeer.getOMClass();
1283                    SorderItem obj1 = (SorderItem)SorderItemPeer
1284                .row2Object(row, 1, omClass);
1285                                                
1286                                                                  
1287                                                        
1288                            
1289              
1290                           omClass = ProductPeer.getOMClass();
1291                          Product obj2 = (Product)ProductPeer
1292                .row2Object( row, offset2, omClass);
1293
1294               boolean newObject = true;
1295            for (int j = 0; j < results.size(); j++)
1296            {
1297                SorderItem temp_obj1 = (SorderItem)results.get(j);
1298                Product temp_obj2 = (Product)temp_obj1.getProduct();
1299                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1300                {
1301                    newObject = false;
1302                                    temp_obj2.addSorderItem(obj1);
1303                                    break;
1304                }
1305            }
1306                            if (newObject)
1307            {
1308                obj2.initSorderItems();
1309                obj2.addSorderItem(obj1);
1310            }
1311                                                                                    
1312                                                                        
1313                            
1314              
1315                           omClass = CustomerPeer.getOMClass();
1316                          Customer obj3 = (Customer)CustomerPeer
1317                .row2Object( row, offset3, omClass);
1318
1319               newObject = true;
1320            for (int j = 0; j < results.size(); j++)
1321            {
1322                SorderItem temp_obj1 = (SorderItem)results.get(j);
1323                Customer temp_obj3 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1324                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1325                {
1326                    newObject = false;
1327                                    temp_obj3.addSorderItemRelatedByCustomerId(obj1);
1328                                    break;
1329                }
1330            }
1331                            if (newObject)
1332            {
1333                obj3.initSorderItemsRelatedByCustomerId();
1334                obj3.addSorderItemRelatedByCustomerId(obj1);
1335            }
1336                                                                                    
1337                                                                        
1338                            
1339              
1340                           omClass = CustomerPeer.getOMClass();
1341                          Customer obj4 = (Customer)CustomerPeer
1342                .row2Object( row, offset4, omClass);
1343
1344               newObject = true;
1345            for (int j = 0; j < results.size(); j++)
1346            {
1347                SorderItem temp_obj1 = (SorderItem)results.get(j);
1348                Customer temp_obj4 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1349                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1350                {
1351                    newObject = false;
1352                                    temp_obj4.addSorderItemRelatedByRecipientId(obj1);
1353                                    break;
1354                }
1355            }
1356                            if (newObject)
1357            {
1358                obj4.initSorderItemsRelatedByRecipientId();
1359                obj4.addSorderItemRelatedByRecipientId(obj1);
1360            }
1361                                                                                    
1362                                                        
1363                            
1364              
1365                           omClass = ProjectPeer.getOMClass();
1366                          Project obj5 = (Project)ProjectPeer
1367                .row2Object( row, offset5, omClass);
1368
1369               newObject = true;
1370            for (int j = 0; j < results.size(); j++)
1371            {
1372                SorderItem temp_obj1 = (SorderItem)results.get(j);
1373                Project temp_obj5 = (Project)temp_obj1.getProject();
1374                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1375                {
1376                    newObject = false;
1377                                    temp_obj5.addSorderItem(obj1);
1378                                    break;
1379                }
1380            }
1381                            if (newObject)
1382            {
1383                obj5.initSorderItems();
1384                obj5.addSorderItem(obj1);
1385            }
1386                                                                                    
1387                                                        
1388                            
1389              
1390                           omClass = CurrencyPeer.getOMClass();
1391                          Currency obj6 = (Currency)CurrencyPeer
1392                .row2Object( row, offset6, omClass);
1393
1394               newObject = true;
1395            for (int j = 0; j < results.size(); j++)
1396            {
1397                SorderItem temp_obj1 = (SorderItem)results.get(j);
1398                Currency temp_obj6 = (Currency)temp_obj1.getCurrency();
1399                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1400                {
1401                    newObject = false;
1402                                    temp_obj6.addSorderItem(obj1);
1403                                    break;
1404                }
1405            }
1406                            if (newObject)
1407            {
1408                obj6.initSorderItems();
1409                obj6.addSorderItem(obj1);
1410            }
1411                                                                results.add(obj1);
1412        }
1413        return results;
1414    }
1415        
1416        
1417                                  
1418                
1419
1420    /**
1421     * selects a collection of SorderItem objects pre-filled with
1422     * all related objects.
1423     *
1424     * This method is protected by default in order to keep the public
1425     * api reasonable. You can provide public methods for those you
1426     * actually need in SorderItemPeer.
1427     *
1428     * @throws TorqueException Any exceptions caught during processing will be
1429     * rethrown wrapped into a TorqueException.
1430     */

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

1611    protected static List JavaDoc doSelectJoinAllExceptCustomerRelatedByCustomerId(Criteria criteria)
1612        throws TorqueException
1613    {
1614        setDbName(criteria);
1615
1616        addSelectColumns(criteria);
1617        int offset2 = numColumns + 1;
1618                                    
1619                    SorderPeer.addSelectColumns(criteria);
1620        int offset3 = offset2 + SorderPeer.numColumns;
1621                                                                
1622                    ProductPeer.addSelectColumns(criteria);
1623        int offset4 = offset3 + ProductPeer.numColumns;
1624                                                                
1625                                                  
1626                                                  
1627                    ProjectPeer.addSelectColumns(criteria);
1628        int offset5 = offset4 + ProjectPeer.numColumns;
1629                                                                
1630                    CurrencyPeer.addSelectColumns(criteria);
1631        int offset6 = offset5 + CurrencyPeer.numColumns;
1632                                                                                                                                                                                                                                                          
1633        List JavaDoc rows = BasePeer.doSelect(criteria);
1634        List JavaDoc results = new ArrayList JavaDoc();
1635
1636        for (int i = 0; i < rows.size(); i++)
1637        {
1638            Record row = (Record)rows.get(i);
1639
1640                            Class JavaDoc omClass = SorderItemPeer.getOMClass();
1641                    SorderItem obj1 = (SorderItem)SorderItemPeer
1642                .row2Object(row, 1, omClass);
1643                                                
1644                                                        
1645                            
1646              
1647                           omClass = SorderPeer.getOMClass();
1648                          Sorder obj2 = (Sorder)SorderPeer
1649                .row2Object( row, offset2, omClass);
1650
1651               boolean newObject = true;
1652            for (int j = 0; j < results.size(); j++)
1653            {
1654                SorderItem temp_obj1 = (SorderItem)results.get(j);
1655                Sorder temp_obj2 = (Sorder)temp_obj1.getSorder();
1656                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1657                {
1658                    newObject = false;
1659                                    temp_obj2.addSorderItem(obj1);
1660                                    break;
1661                }
1662            }
1663                            if (newObject)
1664            {
1665                obj2.initSorderItems();
1666                obj2.addSorderItem(obj1);
1667            }
1668                                                                                    
1669                                                        
1670                            
1671              
1672                           omClass = ProductPeer.getOMClass();
1673                          Product obj3 = (Product)ProductPeer
1674                .row2Object( row, offset3, omClass);
1675
1676               newObject = true;
1677            for (int j = 0; j < results.size(); j++)
1678            {
1679                SorderItem temp_obj1 = (SorderItem)results.get(j);
1680                Product temp_obj3 = (Product)temp_obj1.getProduct();
1681                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1682                {
1683                    newObject = false;
1684                                    temp_obj3.addSorderItem(obj1);
1685                                    break;
1686                }
1687            }
1688                            if (newObject)
1689            {
1690                obj3.initSorderItems();
1691                obj3.addSorderItem(obj1);
1692            }
1693                                                                                    
1694                                                                  
1695                                                                  
1696                                                        
1697                            
1698              
1699                           omClass = ProjectPeer.getOMClass();
1700                          Project obj4 = (Project)ProjectPeer
1701                .row2Object( row, offset4, omClass);
1702
1703               newObject = true;
1704            for (int j = 0; j < results.size(); j++)
1705            {
1706                SorderItem temp_obj1 = (SorderItem)results.get(j);
1707                Project temp_obj4 = (Project)temp_obj1.getProject();
1708                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1709                {
1710                    newObject = false;
1711                                    temp_obj4.addSorderItem(obj1);
1712                                    break;
1713                }
1714            }
1715                            if (newObject)
1716            {
1717                obj4.initSorderItems();
1718                obj4.addSorderItem(obj1);
1719            }
1720                                                                                    
1721                                                        
1722                            
1723              
1724                           omClass = CurrencyPeer.getOMClass();
1725                          Currency obj5 = (Currency)CurrencyPeer
1726                .row2Object( row, offset5, omClass);
1727
1728               newObject = true;
1729            for (int j = 0; j < results.size(); j++)
1730            {
1731                SorderItem temp_obj1 = (SorderItem)results.get(j);
1732                Currency temp_obj5 = (Currency)temp_obj1.getCurrency();
1733                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1734                {
1735                    newObject = false;
1736                                    temp_obj5.addSorderItem(obj1);
1737                                    break;
1738                }
1739            }
1740                            if (newObject)
1741            {
1742                obj5.initSorderItems();
1743                obj5.addSorderItem(obj1);
1744            }
1745                                                                results.add(obj1);
1746        }
1747        return results;
1748    }
1749        
1750        
1751                                            
1752                
1753
1754    /**
1755     * selects a collection of SorderItem objects pre-filled with
1756     * all related objects.
1757     *
1758     * This method is protected by default in order to keep the public
1759     * api reasonable. You can provide public methods for those you
1760     * actually need in SorderItemPeer.
1761     *
1762     * @throws TorqueException Any exceptions caught during processing will be
1763     * rethrown wrapped into a TorqueException.
1764     */

1765    protected static List JavaDoc doSelectJoinAllExceptCustomerRelatedByRecipientId(Criteria criteria)
1766        throws TorqueException
1767    {
1768        setDbName(criteria);
1769
1770        addSelectColumns(criteria);
1771        int offset2 = numColumns + 1;
1772                                    
1773                    SorderPeer.addSelectColumns(criteria);
1774        int offset3 = offset2 + SorderPeer.numColumns;
1775                                                                
1776                    ProductPeer.addSelectColumns(criteria);
1777        int offset4 = offset3 + ProductPeer.numColumns;
1778                                                                
1779                                                  
1780                                                  
1781                    ProjectPeer.addSelectColumns(criteria);
1782        int offset5 = offset4 + ProjectPeer.numColumns;
1783                                                                
1784                    CurrencyPeer.addSelectColumns(criteria);
1785        int offset6 = offset5 + CurrencyPeer.numColumns;
1786                                                                                                                                                                                                                                                          
1787        List JavaDoc rows = BasePeer.doSelect(criteria);
1788        List JavaDoc results = new ArrayList JavaDoc();
1789
1790        for (int i = 0; i < rows.size(); i++)
1791        {
1792            Record row = (Record)rows.get(i);
1793
1794                            Class JavaDoc omClass = SorderItemPeer.getOMClass();
1795                    SorderItem obj1 = (SorderItem)SorderItemPeer
1796                .row2Object(row, 1, omClass);
1797                                                
1798                                                        
1799                            
1800              
1801                           omClass = SorderPeer.getOMClass();
1802                          Sorder obj2 = (Sorder)SorderPeer
1803                .row2Object( row, offset2, omClass);
1804
1805               boolean newObject = true;
1806            for (int j = 0; j < results.size(); j++)
1807            {
1808                SorderItem temp_obj1 = (SorderItem)results.get(j);
1809                Sorder temp_obj2 = (Sorder)temp_obj1.getSorder();
1810                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1811                {
1812                    newObject = false;
1813                                    temp_obj2.addSorderItem(obj1);
1814                                    break;
1815                }
1816            }
1817                            if (newObject)
1818            {
1819                obj2.initSorderItems();
1820                obj2.addSorderItem(obj1);
1821            }
1822                                                                                    
1823                                                        
1824                            
1825              
1826                           omClass = ProductPeer.getOMClass();
1827                          Product obj3 = (Product)ProductPeer
1828                .row2Object( row, offset3, omClass);
1829
1830               newObject = true;
1831            for (int j = 0; j < results.size(); j++)
1832            {
1833                SorderItem temp_obj1 = (SorderItem)results.get(j);
1834                Product temp_obj3 = (Product)temp_obj1.getProduct();
1835                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1836                {
1837                    newObject = false;
1838                                    temp_obj3.addSorderItem(obj1);
1839                                    break;
1840                }
1841            }
1842                            if (newObject)
1843            {
1844                obj3.initSorderItems();
1845                obj3.addSorderItem(obj1);
1846            }
1847                                                                                    
1848                                                                  
1849                                                                  
1850                                                        
1851                            
1852              
1853                           omClass = ProjectPeer.getOMClass();
1854                          Project obj4 = (Project)ProjectPeer
1855                .row2Object( row, offset4, omClass);
1856
1857               newObject = true;
1858            for (int j = 0; j < results.size(); j++)
1859            {
1860                SorderItem temp_obj1 = (SorderItem)results.get(j);
1861                Project temp_obj4 = (Project)temp_obj1.getProject();
1862                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1863                {
1864                    newObject = false;
1865                                    temp_obj4.addSorderItem(obj1);
1866                                    break;
1867                }
1868            }
1869                            if (newObject)
1870            {
1871                obj4.initSorderItems();
1872                obj4.addSorderItem(obj1);
1873            }
1874                                                                                    
1875                                                        
1876                            
1877              
1878                           omClass = CurrencyPeer.getOMClass();
1879                          Currency obj5 = (Currency)CurrencyPeer
1880                .row2Object( row, offset5, omClass);
1881
1882               newObject = true;
1883            for (int j = 0; j < results.size(); j++)
1884            {
1885                SorderItem temp_obj1 = (SorderItem)results.get(j);
1886                Currency temp_obj5 = (Currency)temp_obj1.getCurrency();
1887                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1888                {
1889                    newObject = false;
1890                                    temp_obj5.addSorderItem(obj1);
1891                                    break;
1892                }
1893            }
1894                            if (newObject)
1895            {
1896                obj5.initSorderItems();
1897                obj5.addSorderItem(obj1);
1898            }
1899                                                                results.add(obj1);
1900        }
1901        return results;
1902    }
1903        
1904        
1905                                  
1906                
1907
1908    /**
1909     * selects a collection of SorderItem objects pre-filled with
1910     * all related objects.
1911     *
1912     * This method is protected by default in order to keep the public
1913     * api reasonable. You can provide public methods for those you
1914     * actually need in SorderItemPeer.
1915     *
1916     * @throws TorqueException Any exceptions caught during processing will be
1917     * rethrown wrapped into a TorqueException.
1918     */

1919    protected static List JavaDoc doSelectJoinAllExceptProject(Criteria criteria)
1920        throws TorqueException
1921    {
1922        setDbName(criteria);
1923
1924        addSelectColumns(criteria);
1925        int offset2 = numColumns + 1;
1926                                    
1927                    SorderPeer.addSelectColumns(criteria);
1928        int offset3 = offset2 + SorderPeer.numColumns;
1929                                                                
1930                    ProductPeer.addSelectColumns(criteria);
1931        int offset4 = offset3 + ProductPeer.numColumns;
1932                                                                
1933                    CustomerPeer.addSelectColumns(criteria);
1934        int offset5 = offset4 + CustomerPeer.numColumns;
1935                                                                
1936                    CustomerPeer.addSelectColumns(criteria);
1937        int offset6 = offset5 + CustomerPeer.numColumns;
1938                                                                
1939                                                  
1940                    CurrencyPeer.addSelectColumns(criteria);
1941        int offset7 = offset6 + CurrencyPeer.numColumns;
1942                                                                                                                                                                                                                                                          
1943        List JavaDoc rows = BasePeer.doSelect(criteria);
1944        List JavaDoc results = new ArrayList JavaDoc();
1945
1946        for (int i = 0; i < rows.size(); i++)
1947        {
1948            Record row = (Record)rows.get(i);
1949
1950                            Class JavaDoc omClass = SorderItemPeer.getOMClass();
1951                    SorderItem obj1 = (SorderItem)SorderItemPeer
1952                .row2Object(row, 1, omClass);
1953                                                
1954                                                        
1955                            
1956              
1957                           omClass = SorderPeer.getOMClass();
1958                          Sorder obj2 = (Sorder)SorderPeer
1959                .row2Object( row, offset2, omClass);
1960
1961               boolean newObject = true;
1962            for (int j = 0; j < results.size(); j++)
1963            {
1964                SorderItem temp_obj1 = (SorderItem)results.get(j);
1965                Sorder temp_obj2 = (Sorder)temp_obj1.getSorder();
1966                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1967                {
1968                    newObject = false;
1969                                    temp_obj2.addSorderItem(obj1);
1970                                    break;
1971                }
1972            }
1973                            if (newObject)
1974            {
1975                obj2.initSorderItems();
1976                obj2.addSorderItem(obj1);
1977            }
1978                                                                                    
1979                                                        
1980                            
1981              
1982                           omClass = ProductPeer.getOMClass();
1983                          Product obj3 = (Product)ProductPeer
1984                .row2Object( row, offset3, omClass);
1985
1986               newObject = true;
1987            for (int j = 0; j < results.size(); j++)
1988            {
1989                SorderItem temp_obj1 = (SorderItem)results.get(j);
1990                Product temp_obj3 = (Product)temp_obj1.getProduct();
1991                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1992                {
1993                    newObject = false;
1994                                    temp_obj3.addSorderItem(obj1);
1995                                    break;
1996                }
1997            }
1998                            if (newObject)
1999            {
2000                obj3.initSorderItems();
2001                obj3.addSorderItem(obj1);
2002            }
2003                                                                                    
2004                                                                        
2005                            
2006              
2007                           omClass = CustomerPeer.getOMClass();
2008                          Customer obj4 = (Customer)CustomerPeer
2009                .row2Object( row, offset4, omClass);
2010
2011               newObject = true;
2012            for (int j = 0; j < results.size(); j++)
2013            {
2014                SorderItem temp_obj1 = (SorderItem)results.get(j);
2015                Customer temp_obj4 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
2016                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2017                {
2018                    newObject = false;
2019                                    temp_obj4.addSorderItemRelatedByCustomerId(obj1);
2020                                    break;
2021                }
2022            }
2023                            if (newObject)
2024            {
2025                obj4.initSorderItemsRelatedByCustomerId();
2026                obj4.addSorderItemRelatedByCustomerId(obj1);
2027            }
2028                                                                                    
2029                                                                        
2030                            
2031              
2032                           omClass = CustomerPeer.getOMClass();
2033                          Customer obj5 = (Customer)CustomerPeer
2034                .row2Object( row, offset5, omClass);
2035
2036               newObject = true;
2037            for (int j = 0; j < results.size(); j++)
2038            {
2039                SorderItem temp_obj1 = (SorderItem)results.get(j);
2040                Customer temp_obj5 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
2041                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2042                {
2043                    newObject = false;
2044                                    temp_obj5.addSorderItemRelatedByRecipientId(obj1);
2045                                    break;
2046                }
2047            }
2048                            if (newObject)
2049            {
2050                obj5.initSorderItemsRelatedByRecipientId();
2051                obj5.addSorderItemRelatedByRecipientId(obj1);
2052            }
2053                                                                                    
2054                                                                  
2055                                                        
2056                            
2057              
2058                           omClass = CurrencyPeer.getOMClass();
2059                          Currency obj6 = (Currency)CurrencyPeer
2060                .row2Object( row, offset6, omClass);
2061
2062               newObject = true;
2063            for (int j = 0; j < results.size(); j++)
2064            {
2065                SorderItem temp_obj1 = (SorderItem)results.get(j);
2066                Currency temp_obj6 = (Currency)temp_obj1.getCurrency();
2067                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2068                {
2069                    newObject = false;
2070                                    temp_obj6.addSorderItem(obj1);
2071                                    break;
2072                }
2073            }
2074                            if (newObject)
2075            {
2076                obj6.initSorderItems();
2077                obj6.addSorderItem(obj1);
2078            }
2079                                                                results.add(obj1);
2080        }
2081        return results;
2082    }
2083        
2084        
2085                                  
2086                
2087
2088    /**
2089     * selects a collection of SorderItem objects pre-filled with
2090     * all related objects.
2091     *
2092     * This method is protected by default in order to keep the public
2093     * api reasonable. You can provide public methods for those you
2094     * actually need in SorderItemPeer.
2095     *
2096     * @throws TorqueException Any exceptions caught during processing will be
2097     * rethrown wrapped into a TorqueException.
2098     */

2099    protected static List JavaDoc doSelectJoinAllExceptCurrency(Criteria criteria)
2100        throws TorqueException
2101    {
2102        setDbName(criteria);
2103
2104        addSelectColumns(criteria);
2105        int offset2 = numColumns + 1;
2106                                    
2107                    SorderPeer.addSelectColumns(criteria);
2108        int offset3 = offset2 + SorderPeer.numColumns;
2109                                                                
2110                    ProductPeer.addSelectColumns(criteria);
2111        int offset4 = offset3 + ProductPeer.numColumns;
2112                                                                
2113                    CustomerPeer.addSelectColumns(criteria);
2114        int offset5 = offset4 + CustomerPeer.numColumns;
2115                                                                
2116                    CustomerPeer.addSelectColumns(criteria);
2117        int offset6 = offset5 + CustomerPeer.numColumns;
2118                                                                
2119                    ProjectPeer.addSelectColumns(criteria);
2120        int offset7 = offset6 + ProjectPeer.numColumns;
2121                                                                
2122                                                                                                                                                                                                                                            
2123        List JavaDoc rows = BasePeer.doSelect(criteria);
2124        List JavaDoc results = new ArrayList JavaDoc();
2125
2126        for (int i = 0; i < rows.size(); i++)
2127        {
2128            Record row = (Record)rows.get(i);
2129
2130                            Class JavaDoc omClass = SorderItemPeer.getOMClass();
2131                    SorderItem obj1 = (SorderItem)SorderItemPeer
2132                .row2Object(row, 1, omClass);
2133                                                
2134                                                        
2135                            
2136              
2137                           omClass = SorderPeer.getOMClass();
2138                          Sorder obj2 = (Sorder)SorderPeer
2139                .row2Object( row, offset2, omClass);
2140
2141               boolean newObject = true;
2142            for (int j = 0; j < results.size(); j++)
2143            {
2144                SorderItem temp_obj1 = (SorderItem)results.get(j);
2145                Sorder temp_obj2 = (Sorder)temp_obj1.getSorder();
2146                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2147                {
2148                    newObject = false;
2149                                    temp_obj2.addSorderItem(obj1);
2150                                    break;
2151                }
2152            }
2153                            if (newObject)
2154            {
2155                obj2.initSorderItems();
2156                obj2.addSorderItem(obj1);
2157            }
2158                                                                                    
2159                                                        
2160                            
2161              
2162                           omClass = ProductPeer.getOMClass();
2163                          Product obj3 = (Product)ProductPeer
2164                .row2Object( row, offset3, omClass);
2165
2166               newObject = true;
2167            for (int j = 0; j < results.size(); j++)
2168            {
2169                SorderItem temp_obj1 = (SorderItem)results.get(j);
2170                Product temp_obj3 = (Product)temp_obj1.getProduct();
2171                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2172                {
2173                    newObject = false;
2174                                    temp_obj3.addSorderItem(obj1);
2175                                    break;
2176                }
2177            }
2178                            if (newObject)
2179            {
2180                obj3.initSorderItems();
2181                obj3.addSorderItem(obj1);
2182            }
2183                                                                                    
2184                                                                        
2185                            
2186              
2187                           omClass = CustomerPeer.getOMClass();
2188                          Customer obj4 = (Customer)CustomerPeer
2189                .row2Object( row, offset4, omClass);
2190
2191               newObject = true;
2192            for (int j = 0; j < results.size(); j++)
2193            {
2194                SorderItem temp_obj1 = (SorderItem)results.get(j);
2195                Customer temp_obj4 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
2196                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2197                {
2198                    newObject = false;
2199                                    temp_obj4.addSorderItemRelatedByCustomerId(obj1);
2200                                    break;
2201                }
2202            }
2203                            if (newObject)
2204            {
2205                obj4.initSorderItemsRelatedByCustomerId();
2206                obj4.addSorderItemRelatedByCustomerId(obj1);
2207            }
2208                                                                                    
2209                                                                        
2210                            
2211              
2212                           omClass = CustomerPeer.getOMClass();
2213                          Customer obj5 = (Customer)CustomerPeer
2214                .row2Object( row, offset5, omClass);
2215
2216               newObject = true;
2217            for (int j = 0; j < results.size(); j++)
2218            {
2219                SorderItem temp_obj1 = (SorderItem)results.get(j);
2220                Customer temp_obj5 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
2221                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2222                {
2223                    newObject = false;
2224                                    temp_obj5.addSorderItemRelatedByRecipientId(obj1);
2225                                    break;
2226                }
2227            }
2228                            if (newObject)
2229            {
2230                obj5.initSorderItemsRelatedByRecipientId();
2231                obj5.addSorderItemRelatedByRecipientId(obj1);
2232            }
2233                                                                                    
2234                                                        
2235                            
2236              
2237                           omClass = ProjectPeer.getOMClass();
2238                          Project obj6 = (Project)ProjectPeer
2239                .row2Object( row, offset6, omClass);
2240
2241               newObject = true;
2242            for (int j = 0; j < results.size(); j++)
2243            {
2244                SorderItem temp_obj1 = (SorderItem)results.get(j);
2245                Project temp_obj6 = (Project)temp_obj1.getProject();
2246                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2247                {
2248                    newObject = false;
2249                                    temp_obj6.addSorderItem(obj1);
2250                                    break;
2251                }
2252            }
2253                            if (newObject)
2254            {
2255                obj6.initSorderItems();
2256                obj6.addSorderItem(obj1);
2257            }
2258                                                                                    
2259                                              results.add(obj1);
2260        }
2261        return results;
2262    }
2263                    
2264  
2265      /**
2266     * Returns the TableMap related to this peer. This method is not
2267     * needed for general use but a specific application could have a need.
2268     *
2269     * @throws TorqueException Any exceptions caught during processing will be
2270     * rethrown wrapped into a TorqueException.
2271     */

2272    protected static TableMap getTableMap()
2273        throws TorqueException
2274    {
2275        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
2276    }
2277   
2278    private static void setDbName(Criteria crit)
2279    {
2280        // Set the correct dbName if it has not been overridden
2281
// crit.getDbName will return the same object if not set to
2282
// another value so == check is okay and faster
2283
if (crit.getDbName() == Torque.getDefaultDB())
2284        {
2285            crit.setDbName(DATABASE_NAME);
2286        }
2287    }
2288}
2289
Popular Tags