Hibernate Annotations - Which is better, field or property access?

后端 未结 25 1220
说谎
说谎 2020-11-22 15:02

This question is somewhat related to Hibernate Annotation Placement Question.

But I want to know which is better? Access via properties or access vi

25条回答
  •  情歌与酒
    2020-11-22 15:35

    Both :

    The EJB3 spec requires that you declare annotations on the element type that will be accessed, i.e. the getter method if you use property access, the field if you use field access.

    https://docs.jboss.org/hibernate/annotations/3.5/reference/en/html_single/#entity-mapping

提交回复
热议问题