We prefer having field access to all properties in our domain objects. but due to the lazy initialization exception (due to proxy being initialized) on calling the getId(), we have second thoughts.
But we see that using @AccessType("Property") on top of the id field solves this problem.
In hibernate documentation, they say
Quote:
@org.hibernate.annotations.AccessType
The annotation @org.hibernate.annotations.AccessType should be considered deprecated for FIELD and PROPERTY access. It is still useful however if you need to use a custom access type
Does this mean that this approach of using AccessType("property") is discouraged?
Can any one please enlighten me on any of the disadvange associted with this approach?