Sorry Folks, I may not be very clear in my previous questions. What I want to know is what to code in a .vm file in order to get data from a pair of joint tables.
Table A ID data1 data2 data3 Table B ID LINK_ID <--- joint to ID in Table A data4 data5 I want to get all data in Table B when ID(A) = LINK_ID(B). Assuming that the java code are there already. I only know how to get data from one Table, i.e. $someVector.somedata. thanks michael > The Criteria howto gives very good explanation to the Java code. I > wonder if there is another example given on how to display data from a > pair of joint tables through a .vm file. > > > best wishes > michael > > >> The Criteria howto explains that part. >> >> -----Original Message----- >> From: Eigen Technology Pty Ltd [mailto:[EMAIL PROTECTED]] >> Sent: Sunday, December 15, 2002 1:06 AM >> To: [EMAIL PROTECTED] >> Subject: RE: Join Tables >> >> >> thanks Quinton, >> >> I have read the Peers documentation that comes with TDK. The excerpt I >> included was from there. However, this Peers doco says that the >> subclassing bit is out-of-date. >> >> "Note: some information here is out of date (Subclassing). The Class >> Hierarchy document provides more current information regarding mapping >> a hierarchy in the OM/Peer system." >> >> >> And I don't know where to get an up-to-date one. I just realized that >> by including the FOREIGN key in the schema will get TDK to include >> most of the codes. Now I need an example using Velocity to extract >> data from a pair of joined table. There is no such example in the >> Peers doco. >> >> best wishes >> michael >> >> >> >> >> >> >> >> >>> Read the Criteria Howto for Torque. It explains how to perform >>> joins. >> >>> http://jakarta.apache.org/turbine/torque/criteria-howto.html >>> >>> You should also read over the Peers Howto. You will find a link to >>> this from the above URL. The Peers Howto should probably be read >>> first. >>> >>> -----Original Message----- >>> From: Eigen Technology Pty Ltd [mailto:[EMAIL PROTECTED]] >>> Sent: Sunday, December 15, 2002 12:30 AM >>> To: [EMAIL PROTECTED] >>> Subject: Join Tables >>> >>> >>> hi, >>> >>> could anyone point me to an document that gives instructions to join >>> tables. >>> >>> I read the documentation that came with TDK, it is a bit unclear ... >>> >>> public Vector doSelectWithCategory (Criteria crit) throws Exception { >>> crit.addJoin (ItemPeer.CATEGORY_ID, CategoryPeer.CATEGORY_ID); >>> >>> addSelectColumns ( criteria ); >>> CategoryPeer.addSelectColumns ( criteria ) >>> >>> // BasePeer returns a Vector of Value (Village) arrays. The >>> array >> >>> // order follows the order columns were placed in the Select clause. >>> >>> Vector rows = BasePeer.doSelect(criteria); >>> >>> Vector results = new Vector(); >>> >>> // populate the object(s) >>> for ( int i=0; i<rows.size(); i++ ) >>> { >>> Record row = (Record)rows.elementAt(i); >>> >>> MyItem itm = row2Object (row, >>> 1, >>> Class.forName >>> ("com.mycompany.om.MyItem")) >>> >>> MyCategory cat = CategoryPeer.row2Object >>> (row, >>> numColumns+1, >>> Class.forName >>> ("com.mycompany.om.MyCategory")) >>> >>> itm.setCategory (cat); >>> results.add (itm); >>> } >>> >>> return results; >>> >>> } >>> >>> best wishes >>> michael >>> >>> >>> >>> >>> -- >>> To unsubscribe, e-mail: >>> <mailto:[EMAIL PROTECTED]> >>> For additional commands, e-mail: >>> <mailto:[EMAIL PROTECTED]> >>> >>> >>> >>> -- >>> To unsubscribe, e-mail: >>> <mailto:[EMAIL PROTECTED]> For additional >>> commands, e-mail: <mailto:[EMAIL PROTECTED]> >> >> >> >> >> -- >> To unsubscribe, e-mail: >> <mailto:[EMAIL PROTECTED]> >> For additional commands, e-mail: >> <mailto:[EMAIL PROTECTED]> > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> For additional > commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
