• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

primary key class of entity beans?

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(1) If entity bean operations are on two tables like employee and department then do we need two primary key classes? each for one table?
is it one primary key class for one table?

(2) is primary key class creation is compulsory for table handling in entity beans? If I am doing creation of entity / record then do I need to put setter methods for all fields of that table in primary key class.

(3) in data discriptor if primary key field is filled then do we need to fill <ejb-ql> with select statement.
what I am assuming is either primary key field or ejb-ql any one can present in DD. is it?

Thanks,
Yamini.
 
Narasimha Rao B.
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yamini,

(1) If entity bean operations are on two tables like employee and department then do we need two primary key classes? each for one table?

There is no requirement that each table needs a separate primary key clss. If your business allows you can have a single primary key class for both the tables.
But the main requirement is, primary class fields should be the subset of cmp fields.

(2) is primary key class creation is compulsory for table handling in entity beans? If I am doing creation of entity / record then do I need to put setter methods for all fields of that table in primary key class.

It is not compulsory to have create separate primary key class, if the primary key field is one of the cmp field, then you don't need separate primary key class.
Requiments are, <prim-key-class> field is must in the deployment descriptor.
If your primary key is compound key means, primary key is combination of two or more cmp fields, then you need a separate primary key class.

(3) in data discriptor if primary key field is filled then do we need to fill <ejb-ql> with select statement.
what I am assuming is either primary key field or ejb-ql any one can present in DD. is it?.


I have not understood you question fully. I don't think so, Is there any relation between <ejb-ql> and primary key field.

Thanks,
[ September 03, 2004: Message edited by: Narasimha Rao B. ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic