Hibernate annotation or XML configuration

后端 未结 3 1192
醉梦人生
醉梦人生 2020-11-30 08:57

I have started a new project with Hibernate. Is Hibernate annotation a better choice or is Hibernate XML mapping better?

I have used Hibernate with XML configuration

3条回答
  •  日久生厌
    2020-11-30 09:24

    Annotations are newer, and are the standard way of doing for JPA applications.

    I find them easier to use than XML, but it's a matter of taste and experience. Using them would make you

    • learn something new
    • ready to start a JPA-based project (that could use another implementation)

    I've never been in a situation where I needed XML because annotations didn't allow me to do what I wanted.

提交回复
热议问题