inverse relationships ORM

Is there any examples of using inverse relationships in CB, I am
finding it hard to get my head around using my link tables in CB. for
example updating or getting a recorded and its relationships.

so say I have a user and that user belongs to a company. my user.cfc
looks a bit like this...

     /* link tables */
     property name="user" fieldtype="many-to-many" CFC="company"
linktable="user2company" FKColumn="user_id"
inversejoincolumn="com_id" lazy="true" cascade="all" orderby="com_id";

this creates the look up table "user2company"

now say I want to find a user and the company they belong to, would
this work?.....

userService.executeQuery("from user as userTable inner join
userTable.com_id as companyID");

not sure I am getting it despite reading lots. could someone explain
in the context of CB.

second on updating a new user how does hibernate know what to update/
add in the link table? does hiernate handle this or do I manually
update this table?

Assuming your relationships are set up correctly, all you should need to do to get the companies that a user belongs to is call getCompanies() off of the user. I would rename your property there in the user.cfc to companies, not user. So
/* link tables */
           property name="companies" singularname="company" fieldtype="many-to-many" CFC="company"
linktable="user2company" FKColumn="user_id"
inversejoincolumn="com_id" lazy="true" cascade="all" orderby="com_id";

user = UserService.get(someUserID);
Companies = user.getCompanies();

Curt Gratz
Computer Know How