It depends on what you do :
* For insert/update, then Hibernate doesn't have to create any object and will "just" use reflection to access your properties. In this case, most of the time, only your code will just have done a completely classical new somewhere.
* For loading, then yes, it will use the default constructor (could be less visible than public btw) and then call the needed setters after having executed the SQL code through JDBC.
In case you don't know, remember that Hibernate makes heavy use of class generation (dynamic proxy, for example), reflection and so on. Actually, for example, when instantiating an object at runtime when you request one to be loaded, it dynamically creates classes that inherits your POJO. That's why Hibernate can access protected fields and methods without any problem (it can also access private field with a small additional conf, btw).
_________________ Baptiste
PS : please don't forget to give credits below if you found this answer useful :)
|