I am using HIbernate version 3.2.5.
I read the below line in hibernate tutorials:
The no-argument constructor is a requirement for all persistent classes.Hibernate has to create objects for you, using Java Reflection. The constructor can be private
This is the link for the tutorial:
http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/tutorial.html
But when I write a persistence class without a no-arg constructor, then also it works fine (I tried only retrieval part).
Hence where lies the validity of the above statement?
Please let me know if I am getting something worng.
Regards,
If you don’t have any constructor in persistent class, JVM by default creates no-arg constructor for you, that is the reason why your code is working fine.
Read this tutorial to understand more about constructors.