Nice question,
By definition and entity
is a class that can be persisted to a db
, so having a final field would make no sense in the context of something that will end up being a record in your db. The requirement of final class and no final methods has to do with the way in which JPA
implementations actually deal with persisting instances of your entities classes.
It is common for implementations to subclass your class at runtime and/or add byte code dynamically to your classes, in order to detect when a change to an entity object has occurred. If your class is declared as final, then that would not be possible.
There is of course a lot more reasons than just those, here is an article that gives more information of how ORM in general work behind the covers, that might help you better understand the other requirements for JPA entities