Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Constructor in Hibernate persistent class.

 
Gundum Hoi
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to understand the Hibernate Reference Doc :

In the doc, Section 4.1.1 (Hibernate Reference Documentation Version: 3.1.3 link : http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#persistent-classes-pojo ), there are these sentences/statements :

There are four main rules to follow here...
4.1.1. Implement a no-argument constructor
Cat has a no-argument constructor. All persistent classes must have a default constructor (which may be nonpublic) so that Hibernate can instantiate them using Constructor.newInstance().


But I can't find the fore-mentioned constructor in the whole of the Cat.java class code.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a class does not explicitly declare any constructors, the Java compiler automatically provides a no-argument constructor, called the default constructor, that calls the parent's no-argument constructor
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!