开发者

DO i need to put mapping in hibernate config

开发者 https://www.devze.com 2023-02-14 13:55 出处:网络
On internet tutorial says that i have to add <mapping class=\"com.vaannila.student.Student\" /> <mapping class=\"com.vaannila.student.Phone\" />

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
0

精彩评论

暂无评论...
验证码 换一张
取 消