Thanks Jon, I merely provided the "employees" example as that, a simple explanation of what I was talking about. I was curious to see if Torque was capable of such functionality.
I better get back to poorly designing tables and improperly naming them. -chris > -----Original Message----- > From: Jon Scott Stevens [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, May 29, 2002 6:29 PM > To: Turbine Torque Users List > Subject: Re: Joins on same table? > > > on 5/29/02 5:27 PM, "Stephen Haberman" <[EMAIL PROTECTED]> wrote: > > > I don't have a test environment where I could readily try > this out (and > > I assume, Jon, that you'll know off the top of your head)...out of > > curiosity, is Torque capable of doing the same-table inner join, > > regardless of whether it's bad design or not? > > > > Thanks, > > Stephen > > Torque itself doesn't do it. You need to write BO code to do > it. We do it in > Scarab for nested Module relationships where you have: > > SCARAB_MODULE.MODULE_ID > SCARAB_MODULE.PARENT_ID > > And PARENT_ID is a MODULE_ID. > > So, in Module.java we have a method: > > public Module getParent() > { > // assuming you use the new Manager code in Torque > return ModuleManager.getInstance(getParentId()); > } > > Thus, in the case of: > > create table employees ( > employee_id int, > employee_name varchar(50), > manager_id int > ); > > public Employees getManager() > { > return EmployeesManager.getInstance(getManagerId()); > } > > I could be wrong, but Torque might also generate these > methods for you. > > As you can see, that also shows the terrible idea to use the name of > 'employees' for a table name. It should simply be 'employee' > > It isn't really a matter of a same table inner join since you > are simply > dealing with getting the object which represents the id of > the table you are > querying against. > > -jon > > > -- > 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]>
