Hi,
I have four tables Accounts, Users, Role and AccountRoles in database. In table fields are
Accounts:
AccountId,
UserId,
LoginId,
Password,
etc.,
Users:
UserId,
FirstName,
LastName,
EmailId,
etc.,
Role:
RoleId,
Roles,
Description,
etc.,
AccountRoles:
AccountRoleId,
AccountId,
RoleId,
etc.,
I retrieve Roles Using LoginId and Password. I am using inner join in sql server. It is working. the Join is:
select Accounts.LoginId,Accounts.Password, Roles.Roles from Roles inner join (AccountRoles inner join (Accounts Inner Join Users on Accounts.UserId=Users.Userid) on AccountRoles.AccountId=Accounts.AccountId) on Roles.RoleId=AccountRoles.Roleid where (((Accounts.Loginid)='general' and (Accounts.password)='general'));
This Join is working in sql server 2005.
In hibernate how to modify in this join and how to write Data Access Layer to Retrieving Roles. Please Explain me or give me any article to near to regarding this.
|