Hi need help for the ejbrelation work ......i m new kid in this field........
    I have two entity bean User and Role . User and Role having bidirectional one to Many relationship.
I m using userID as primary key in User Entity Bean , it is db auto increment field .
And roleID as the primary  Key in the Role Entity Bean , also it is db auto increment field  primary field
I m able to use autoincrement field as primary key  as these fields are  not cmp fields (managed by db)
so userID and roleID field  are not entered in the ejb-jar.xml
I can add user and roles and set relationship between them .
 
If i want to get all the roles for the user . i have two ways firstly get the user remote object and the call the relationship method to getRole() . it gives me all the roles assinged to the that user. This has the limitation i have to create user local object ..then get the roles .
 
Another way is to write ejb-ql and by giving userID can list all the roles assigned to that user. I have written the ejb-ql but not working :) ........ can someone plss check and help mee out to solve this ...
 
i m attaching the code ...
 
Struture is As
---------
User
---------
userID     --------->  Auto increment Primary Key field
username
password
email
name
salary
       
--------
Role
--------
roleID      --------->  Auto increment Primary Key field
rolename
description                                                                           one  to many
userID  -------------> CMR field added (setting relationship User tto Role )
 
   
 
 
Brijesh Sood

Attachment: ejbql.zip
Description: Zip compressed data

Reply via email to