Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

primary key entity bean

 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


public class MYPK{

public int x;
public Strubg y;
}

Is this a valid PK. In the mock exams sometimes the answer is valid and sometimes invalid. The reason is it doen;t have the default constructor and thus is invalid. Also the default constructor will be provided by the compiler and thus its valid.

What should be the answer.

Sawan
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any suggestions.
 
Miki Muzsi
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As described in ejb spec (pg. 203) the primary key class must be:
- public
- have a public constructor with no arguments
- have all members public

Assuming by public Strubg y; you ment public String y; ;-), you class does represent a valid primary key. The constructor is automatically generated...

Miki
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic