This week's book giveaway is in the Java 9 forum.
We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line!
See this thread for details.
Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Entity Beans Questions  RSS feed

 
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
Boost this thread!