| When an entity has public fields, it cannot be correctly "proxified" unless bytecode enhancement is enabled. When an entity has final getters/setters, those getters/setters cannot be "proxified" either. If a user doesn't know about this, at some point he will encounter strange issues of uninitialized entities (when accessing a public field or final getter on the proxy) or even data loss (when storing data on the public field or using a final setter on the proxy). That's acceptable, but what's more annoying is that users have a hard time knowing why this happens. A demonstration of such an issue can be found here: https://github.com/yrodiere/hibernate-test-case-templates/tree/HSEARCH-2541-HHH. The second-but last commit introduces a failing test case, and the last commit fixes the issue by setting up bytecode enhancement. I am unsure if those limitations are documented, but even if they are, I think such issues should at least trigger warnings in the logs, or even exceptions (if it's not too much of a change). Ideally those would be triggered during bootstrapping. Note that another approach would be to disable proxying altogether when such a situation arises, but then again that may be too much of a change for a minor release. |