Why can't you make your manytoone a onetomany?

Mark

On Fri, Oct 24, 2008 at 6:24 PM, David Mineer <[EMAIL PROTECTED]> wrote:
> One last question now that this code works.
>
> Where is the best place for it?  In my company gateway?  Then I have to call
> it whenever I get a company.
>
> At first I was trying to make it a one-to-many.  It would be nice to just
> have the getSatellitesArray() available with the company object. But that
> doesn't work cause of the duplicate column error.
>
> So then I thought about putting it in the decorator.  There is alot of
> chatter about this on the list and while there is a lot of discussion it
> seems most think it inappropriate in there.
>
> Do you have any quick comments about that?
>
> On Fri, Oct 24, 2008 at 1:18 AM, David Mineer <[EMAIL PROTECTED]> wrote:
>>
>> That worked.  Don't know why I just can't wrap my head around these
>> things.
>>
>> I don't think I can even sum this on up, at least not legibly, but I do
>> think I understand it.
>>
>> Thanks!
>>
>> On Fri, Oct 24, 2008 at 1:02 AM, Mark Mandel <[EMAIL PROTECTED]>
>> wrote:
>>>
>>> Does this make more sense?
>>>
>>> select
>>>  child.id
>>>  child.name
>>> from
>>>  company.company child
>>> join
>>>  company.company parent
>>> where
>>>  parent.id = :id
>>>
>>> The id of the parent will always be the same as the parentid, as they
>>> are joined.
>>>
>>> Mark
>>>
>>>
>>>
>>> On Fri, Oct 24, 2008 at 5:48 PM, David Mineer <[EMAIL PROTECTED]> wrote:
>>> >
>>> > Actually I guess it would be more correct to say I need parentid =
>>> > companyid
>>> >
>>> > On Fri, Oct 24, 2008 at 12:44 AM, David Mineer <[EMAIL PROTECTED]>
>>> > wrote:
>>> >> The :id value that I am passing is a companyid.  I want all records
>>> >> that have a parentid that = companyid.
>>> >>
>>> >> Your example just gives me where companyid = companyid.
>>> >>
>>> >> I need companyid = parentid.
>>> >>
>>> >> On Fri, Oct 24, 2008 at 12:39 AM, Mark Mandel <[EMAIL PROTECTED]>
>>> >> wrote:
>>> >>>
>>> >>> Oh I see.
>>> >>>
>>> >>> Should be:
>>> >>>
>>> >>> from company.company as c join company.company as p where c.id = :id
>>> >>>
>>> >>> Mark
>>> >>>
>>> >>>
>>> >>> On Fri, Oct 24, 2008 at 5:37 PM, David Mineer <[EMAIL PROTECTED]>
>>> >>> wrote:
>>> >>>> Message The property that was searched for could not be found
>>> >>>> Detail The property 'parentid' could not be found in the object
>>> >>>> 'company.company'
>>> >>>>
>>> >>>> On Fri, Oct 24, 2008 at 12:25 AM, Mark Mandel
>>> >>>> <[EMAIL PROTECTED]> wrote:
>>> >>>>>
>>> >>>>> sorry.. that's what I mean to write. What's wrong with what yuo do
>>> >>>>> below?
>>> >>>>>
>>> >>>>> Mark
>>> >>>>>
>>> >>>>> On Fri, Oct 24, 2008 at 5:05 PM, David Mineer <[EMAIL PROTECTED]>
>>> >>>>> wrote:
>>> >>>>> > But there is only one object: company.company
>>> >>>>> >
>>> >>>>> > Id is the pk in company
>>> >>>>> > parentid is the fk to id in the same table (company).
>>> >>>>> >
>>> >>>>> > This tql is one of the things I tried:
>>> >>>>> >
>>> >>>>> >
>>> >>>>> > "from company.company as c join company.company as p where
>>> >>>>> > p.parentid =
>>> >>>>> > :id
>>> >>>>> > order by p.name asc");
>>> >>>>> >
>>> >>>>> >
>>> >>>>> >
>>> >>>>> > On Thu, Oct 23, 2008 at 11:48 PM, Mark Mandel
>>> >>>>> > <[EMAIL PROTECTED]>
>>> >>>>> > wrote:
>>> >>>>> >>
>>> >>>>> >> 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
>>> >>>>> >>
>>> >>>>> >> 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
>>> >>>>>
>>> >>>>> 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
>>> >>>
>>> >>> >>
>>> >>>
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> 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.
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > 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
>>>
>>> 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.
>>
>>
>>
>> --
>> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to