using findWhere (CRITERIA) on lookup tables.

Just a few things tonight into my journey of CB and ORM.

I am using findWhere as documentation in the Base ORM Service. The
first thing is that the documentation states that only entityName is
required, but I get asked for "Criteria" as a required collection of
arguments for this function.

is this correct?

anyhow, thats not an issue my question is on the the error below with
this code...

rc.ouserbean =
userService.findWhere(entityName="user",CRITERIA={user_name=rc.ouserbean.getuser_name()});

org.hibernate.QueryException: could not resolve property: com_id of:
user [from user as userTable inner join userTable.com_id as
companyID]

now com_id is in a lookup table not in user table, I understand my
relationship and that ORM is being smart and wants to return the user
and the company its associated with (well I think it is). thats good,
so how to a get about the error above? I have tried to add the com_id
the user will be linked in the link table but then I get the message
"Property COM_ID not present in the entity." which is correct as it's
not in my user entity.

so the short question is how to I return my user details using
findWhere when I a link table?

Any help in understanding this would be appreciated. I have included
just for you reference the CFC that set-up the tables Thanks

any docs that point me in the right direction to understanding
findWhere when used with a link table? I have searched but unsure what
it is I am looking for. the above issue is because of this I think.

You can't use find where to search across you many-to-many relationship. You could use findIt or findAll and then use HQL to do your search. Here is a link to an article by Ray Camden on some HQL to search across a many-to-many.

Hope that helps,
Curt Gratz
Computer Know How

I am using findWhere as documentation in the Base ORM Service. The
first thing is that the documentation states that only entityName is
required, but I get asked for "Criteria" as a required collection of
arguments for this function.

is this correct?

Yep it changed in M6. See his blog post.
http://blog.coldbox.org/post.cfm/coldbox-orm-service-changes-from-m5-to-m6

rc.ouserbean =
userService.findWhere(entityName="user",CRITERIA={user_name=rc.ouserbean.getuser_name()});

org.hibernate.QueryException: could not resolve property: com_id of:
user [from user as userTable inner join userTable.com_id as
companyID]

BaseORMService.FindWhere() works for me fine in M6.

First - something seems amiss here. How can you be
calling .getUser_name() on a component that does not yet exist (you
are setting it in the findWhere)? Do a dump of
"rc.ouserbean.getuser_name()" and assure it is returning a string of
the username you want to pull up.

findWhere() is a wrapper calling EntityLoad with a set of parameters
(criteria param passed straight in). You appear to be doing a query to
say "give me the user where user_name = XXX". This should be working
fine and couldn't have anything to do with the relationship set up.
Try a hardcoded findWhere(entityName="user", criteria={user_name =
"xxxx"}) call and see if that works (putting a valid user_name in
"xxxx").

-m