Performance difference between annotating fields or getter methods in Hibernate / JPA

前端 未结 3 1717
太阳男子
太阳男子 2020-12-16 04:09

I was curious if anyone had any hard numbers around the performance difference between annotating Entities using private fields instead of public getter methods. I\'ve hear

3条回答
  •  忘掉有多难
    2020-12-16 05:09

    Generally use annotation in above of getter methods, Because when class is loaded in JVM ath that hibernate model or entity class is also loaded then if you use annotation above of field or peroperty then it will execute only once at time of each request. whereas if you placing above getter then in reflaction or any other layer when it will caled this class then getter method called then this become very useful

提交回复
热议问题