View Javadoc

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