John
John

Reputation:

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 tested i didn't used mapping anywhere in file and it was working . so i am confused

Upvotes: 0

Views: 178

Answers (1)

Matt Ball
Matt Ball

Reputation: 359786

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

Upvotes: 1

Related Questions