I am using hibernate annotations and for that in the hibernate.cfg.xml
i need to add annotated classes like this <mapping class="p.Customer" />
here p is the package name and Customer is the annotated bean.
Suppose i have 20 such kind of annotated classes, it means I have to write 20 mapping lines for that class.In Spring there is a property packageToScan
that can be used to register/load all hibernate annotated classes in the specified package.
Since I am not using Spring, can we have the same functionality in Hibernate?
Also I found one tag in hibernate.cfg.xml
<mapping package="" />
at first I thought this will do the job for me, but it didn't work. I didn't get what is the use of this property.