开发者

Why JPA entity class and its methods must not be declared final?

开发者 https://www.devze.com 2023-01-07 15:37 出处:网络
I think that it makes sense for the entity variables to not be final as they are synchronized with the DB, but why for clas开发者_如何学编程s and methods ??Because persistence providers make proxies o

I think that it makes sense for the entity variables to not be final as they are synchronized with the DB, but why for clas开发者_如何学编程s and methods ??


Because persistence providers make proxies of objects using some library like CGLIB or javassist. These proxies are creating runtime subclasses of the entities. That's why they should not be final.

0

精彩评论

暂无评论...
验证码 换一张
取 消