Just do a TQL join but simply alias the object names to different names I can't see your object names, but:
from A as parent join B as child where child.foo = :bar Mark On Fri, Oct 24, 2008 at 4:24 PM, David Mineer <[EMAIL PROTECTED]> wrote: > > I have a table with a self-join. Company with a column for a parent > company parentid. > > Here is my table definition: > > <id name="id" column="companyId" > type="numeric"/> > <property name="name" type="string" > column="companyName" nullable="false"/> > <property name="phone" type="string" > column="phone1" nullable="true"/> > <property name="fax" type="string" > column="fax" nullable="true"/> > <property name="licenseNo" type="string" > column="licenseNo" > nullable="true"/> > <property name="address1" type="string" > column="address" nullable="true"/> > <property name="address2" type="string" > column="address2" nullable="true"/> > <property name="city" type="string" > column="city" nullable="true"/> > <property name="state" type="string" > column="state" nullable="true"/> > <property name="zip" type="string" > column="zip" nullable="true"/> > <property name="web" type="string" > column="web" nullable="true"/> > <property name="email" type="string" > column="email" nullable="true"/> > <property name="areaId" type="string" > column="areaId" nullable="false"/> > <property name="createdate" type="date" > column="createdate" > nullable="false"/> > <manytoone name="parent" lazy="true"> > <link to="company.company" > column="parentid"/> > </manytoone> > > This works great. Can save the parentid to that field. > > But! I also want a list of what I call the "satellites". These are > an records where the parentid = the current companyid. > > So I pass a companyid and I want an array or query of all records that > have that companyid in the parentid field. > > I can't simply do a "from company.company where parentid = :id" > because parentid is a property in the company table. And I can't do > what I would normally do if the relationship was to another table > which would have the parentid property. This would be a simple tql > join query. > > How do I return a query or array of all the sattelites as explained above? > > I did try to have a one to many like this: > > <onetomany name="satellites" lazy="true"> > <link to="company.company" > column="parentid"/> > <collection type="array"/> > </onetomany> > > But that gives the duplicate column error when I try and save. > > Thanks for your help, > > -- > David Mineer Jr > --------------------- > The critical ingredient is getting off your > butt and doing something. It's as simple > as that. A lot of people have ideas, but > there are few who decide to do > something about them now. Not > tomorrow. Not next week. But today. > The true entrepreneur is a doer. > > > > -- E: [EMAIL PROTECTED] W: www.compoundtheory.com --~--~---------~--~----~------------~-------~--~----~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups "transfer-dev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en -~----------~----~----~----~------~----~------~--~---
