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

Entity Beans Questions

 
Amit Suresh Pawar
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Just some simple questions regarding Entity Beans:

1. Why the Persistent instance variables must not be declared as Public.
2. Can we declare the instance variables and methods final.

Could you please explain the second point with example.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

They can be public or protected if you are using field-based access.(The reason for this(I'm guessing) is that public and protected both allow a subclass to access the fields,which may be how the persistence provider works with them)
But if you are using property-based access then they should conform to the Javabeans spec.Found here
The instance variables should not be declared as final because the persistence provider may need to override them.

I'm not sure about the methods though...haven't read that far....
By the way they are not called 'Entity beans' they are just plain 'entities'...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic