DO i need to put mapping in hibernate config
On internet tutorial says that i have to add
<mapping class="com.vaannila.student.Student" />
<mapping class="com.vaannila.student.Phone" />
in the hibernate config file
But i am using annotations and in one example which i teste开发者_开发技巧d i didn't used mapping anywhere in file and it was working . so i am confused
If you are using annotations, you do not need a Hibernate XML config file. The point of the annotations is to eliminate such a need.
The XML-file method of configuring ORMs came first, and is generally regarded as a more verbose, cumbersome, and (generally speaking, mind you) worse method. This is in comparison to the newer annotations-based configuration which you've already experimented with.
Recommended reading
- hibernate using annotations or using hibernate configuration files
- Mixing JPA annotations and XML configuration
精彩评论