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

前端 未结 5 867
小鲜肉
小鲜肉 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条回答
  •  -上瘾入骨i
    2020-12-08 06:04

    There's no functional reason for not annotating the same class with both JPA and JAXB annotations, I've done it myself on occasion. It does become a bit hard to read, though, and sometimes you want different class design trade-offs with JAXB and JPA. In my experience, these trade-offs usually mean you end up with two class models.

提交回复
热议问题