[hibernate-dev] HHH-11791

Christian Bongiorno christian.bongiorno at gmail.com
Mon Jun 12 15:19:56 EDT 2017


Now that java 8 supports named parameters it becomes possible (potentially
preferrable) to use constructor injection instead of circumventing
encapsulation to set values on private fields.

This shows itself as a potential win when integrating with Kotlin with
disallows the circumvention quite forcefully. Meaning: without constructor
injection the object needs setters. And, if it has setters then it's
mutable which is against best practices.

I propose optionally using constructor injection when marshalling an object
from data sources in a DB. I am willing to make the changes if I know they
can/will be incorporated.

Thoughts? Here is the ticket
https://hibernate.atlassian.net/browse/HHH-11791


More information about the hibernate-dev mailing list