Tom-

You don't need the LinkTable attribute in a one-to-many.  You only need
that in a many-to-many.  I'm not sure what tutorial you copied that from...

I would simplify your problem till you understand how the code works and
can get some basic examples working, then build up to more.  Start with
just two objects, and just a few properties on each object.  If you need to
make some fake tables and fake CFC entities to play with while learning -
go ahead, do it - it may pay off.

Maybe just start with the Client and User objects, use the code from the
article below, and just change the property names to match your objects.
 Only use the attributes shown in the article.  Don't add any complexity
till you get that going.  Then after you have those working, add roles into
the mix.

http://www.manjukiran.net/2009/07/15/coldfusion-orm-define-one-to-many-and-many-to-one-relationships/

Then one you have things working and have a very basic understanding, read
this series of HQL and ORM posts by Brian Kotek.  Brian's articles may make
things seem more complicated to you though, so I'd start with just the very
basics and build from there.  You probably just want to bookmark these
articles for late.  Start with the first, simpler example first.

http://www.briankotek.com/blog/index.cfm/2010/9/9/Using-ColdFusion-ORM-and-HQL-Part-1

-Cameron

On Mon, Dec 12, 2011 at 7:30 PM, Tom Small <t...@re-base.net> wrote:

>
> Hi Cameron,
>
> Below is a snippet of code, and appreciate your assistance in this
> matter...
>
>
>
> <cfcomponent hint="clients CFC" output="false" persistent="true"
> table="clients" entityname="Clients">
>
>
>        <cfcomponent hint="clients CFC" output="false" persistent="true"
> table="clients" entityname="Clients">
>
>
>        <cfproperty
>                name="ClientID"
>                hint="id for clients"
>                type="numeric"
>                required="true"
>
>                fieldtype="id"
>                generator="identity"
>                ormtype="integer"
>                notnull="true">
>
>
>        <cfproperty
>                name="UsersObj"
>                fieldtype="one-to-many"
>                linktable="ClientUser"
>                type="array"
>                cfc="users"
>                inverse="true"
>                cascade="all-delete-orphan"
>                fkcolumn="clientid"
>                inversejoincolumn="userid"
>                lazy="false"
>                singularname="UsersObj">
>
>        <cfproperty
>                name="UserroleObj"
>                fieldtype="one-to-many"
>                linktable="ClientUserRole"
>                type="array"
>                cfc="userrole"
>                inverse="true"
>                cascade="all-delete-orphan"
>                fkcolumn="clientid"
>                inversejoincolumn="userroleid"
>                lazy="false"
>                singularname="UserroleObj">
>
>
>
>        <cfproperty
>                name="clientname">
>
>        <cfproperty
>                name="isactive">
>
>        <cfproperty
>                name="departmentname">
>
>        <cfproperty
>                name="departmentaddress">
>
>        <cfproperty
>                name="contactname">
>
>        <cfproperty
>                name="contactemail">
>
>        <cfproperty
>                name="contacttelephone">
>
>        <cfproperty
>                name="accounttype">
>
>        <cfproperty
>                name="startdate">
>
>        <cfproperty
>                name="expirydate">
>
>        <cfproperty
>                name="paymentmethod">
>
>        <cfproperty
>                name="notes">
>
> -------------------------------------------
>
> <cfcomponent hint="users CFC" output="false" persistent="true"
> table="users" entityname="Users">
>
>
>        <cfproperty
>                name="userid"
>                hint="id for users"
>                type="numeric"
>                required="true"
>
>                fieldtype="id"
>                generator="identity"
>                ormtype="integer"
>                notnull="true">
>
>
>
>        <cfproperty
>                name="email">
>
>        <cfproperty
>                name="password">
>
>        <cfproperty
>                name="title">
>
>        <cfproperty
>                name="firstname">
>
>        <cfproperty
>                name="lastname">
>
>        <cfproperty
>                name="position">
>
>        <cfproperty
>                name="isactive">
>
>        <cfproperty
>                name="userroleid">
>
>        <cfproperty
>                name="showassistance">
>
>        <cfproperty
>                name="failedloginattempts">
>
>        <cfproperty
>                name="passwordexpires">
>
>
>
>        <cfproperty
>                name="ClientsID"
>                fieldtype="many-to-one"
>                linktable="ClientUser"
>                fkcolumn="userID"
>                inversejoincolumn="clientID"
>                cfc="clients"
>                singularname="Clients">
>
> </cfcomponent>
>
> -------------------------------------------
>
> <cfcomponent hint="user role CFC" output="false" persistent="true"
> table="userrole" entityname="Userrole">
>
>
>        <!--- define the user role properties --->
>        <cfproperty
>                name="userroleid"
>                hint="id for user role"
>                type="numeric"
>                required="true"
>
>                fieldtype="id"
>                generator="identity"
>                ormtype="integer"
>                notnull="true">
>
>        <cfproperty
>                name="rolename">
>
>
>
>        <cfproperty
>                name="ClientsID"
>                fieldtype="many-to-one"
>                linktable="ClientUserRole"
>                fkcolumn="userroleid"
>                inversejoincolumn="clientID"
>                cfc="clients"
>                singularname="Clients">
>
>
> </cfcomponent>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349075
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to