db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Bowen <s...@yahoo.com>
Subject How to use doSelectJoin?
Date Thu, 17 Mar 2005 16:08:06 GMT
Hello all.

I would like to use doSelectJoin to populate some sub
objects. Here is the scenario:

TABLE user
pk id_user
...

TABLE profile
pk id_profile
...

TABLE users_profiles
fk id_user
fk id_profile

ie. all users can have n profiles.

When the user logs in I would like to load all of his
associated "users_profiles" objects *and* all of the
"profile" objects associated with those (to have
access to the name of the profile). Since I stick the
"user" object in my session, and later on make many
checks on the profile that user has, I would like not
to have to keep calling the database from my .jsp's.

I have been looking at
BaseUsersProfilesPeer.doSelectJoinProfiles, which
seems to load all the "profiles" associated with any
"users_profiles", but I don't see anything similar in
my BaseUserPeer class.

I guess that's the way Torque works -- it generates
these doSelectJoinXxx() methods for the tables which
contain foreign keys TO them FROM other tables. 

So how can I do the same thing for "user", which has a
foreign key TO "users_profiles"?

I'll keep looking!

Thanks,
Bob

ps. I have heard Hibernate does this "full-load" by
default, ie. it automatically loads all info for any
foreign keys. Is this true? Sounds nice but expensive!



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message