[jboss-user] [JBoss Seam] - how to write a code
nako_ruru
do-not-reply at jboss.com
Fri Sep 29 11:35:20 EDT 2006
I have 3 classes. User, RoleRef, Role
| public class User {
|
| public void setId(int id) {
| ...
| }
|
| public int getId() {
| return ...;
| }
|
| }
|
| public class Role {
|
| public void setId(int id) {
| ...
| }
|
| public int getId() {
| return ...;
| }
|
| }
|
| public class RoleRef {
|
| private User user;
| private Role role;
|
| public User getUser() {
| return user;
| }
|
| public Role getRole() {
| return role;
| }
|
| public void setUser(User user) {
| this.user = user;
| }
|
| public void setRole(Role role) {
| this.role = role;
| }
|
| public boolean equals(Object o) {
| if(o == this) {
| return true;
| } else if(o == null) {
| return false;
| } else if(o instanceof RoleRef) {
| RoleRef referrence = (RoleRef) o;
| return user.equals(referrence.user) && role.equals(referrence.role);
| } else {
| return false;
| }
| }
|
| }
|
The mapped tables are respective role, roleref, user.
Now assume that I have an instance of User, how can I write criteria code which is the same as sql expression as below.
"select role.* from user, roleref, role where user.id = roleref.uid && roleref.rid = role.id".
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975176#3975176
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975176
More information about the jboss-user
mailing list