EJB Entity Class, its methods and Persistence variables must not be final
posted 7 years ago
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
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 ?