It's very strange that I have to model the join table.

For example, I model a data object named User for table CCP_User like
following, Role for table CCP_ROLE,
If I need to get the role list of a User, I have to create a data object
named UserRole for the join table CCP_USER_ROLE, which has two properties:
userId and roleId.

class User {
 List userRole ;     //when a User data object retrieved from database,
this property contains UserRole data objects
 ...
}


class UserRole{
String userId;
String roleId;
 ...
}

class Role{
String roleId;
String roleDesc;
 ...
}

When I get a User data object from database, I can know the role's id which
related to User from UserRole, but if
I want to know the role's description, I have to query again.

Am I right? If I am, Tuscany Das should improve on it from my view of point,
otherwise, it's very hard to use it.

Reply via email to