• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Entity Class, its methods and Persistence variables must not be final

Deepak Jain
Ranch Hand
Posts: 637
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB Persistence Spec Section 2.1 : The entity class must not be final. No methods or persistent instance variables of the entity class may be

Hi ,
As you know that Entity class must not be declared as final. The only reason , I can think of it is that the Application server might be extending the user written entity class. Cause the excat reverse of this is the purpose of final. Is this explanation correct?
Question 2: If yes can i see the resulting class which could have extended my Entity class?
Queston 3: Further to this rule, any method in the entity class must not be declared as final. This means that Application server again would be extending the class and overriding all the methods in the entity class. Is this correct?
I think if one can get to see the resulting class, these questions can be answered very easily.
Question 4: Whats with not allowing to declare variables with final? Why is this rule applied ?

I hope to get answers to my questions.

Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!