Do Domain Classes usually get JPA or JAXB Annotations or both?

前端 未结 5 858
小鲜肉
小鲜肉 2020-12-08 05:28

I have a Java enterprise application that provides a web service, has a domain layer, and a hibernate persistence layer. In this particular case, there is not a huge differ

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-08 06:17

    I know this question is a bit old, but I thought I'd weigh in anyways since this is an issue that I've recently come across. My recommendation would be to leave your JAXB annotated classes alone, since any schema change will require re-generating these classes. Meaning you will have to re-enter any hibernate annotations, etc. manually. This may be a little out-dated solution, but I think it would be perfectly reasonable to create a hibernate mapping file (.hbm.xml) to house the mappings externally. This is a little more flexible, less cluttered, and just as useful in my opinion.

提交回复
热议问题