Introduce @IdGetter and @IdSetter

Description

When utilizing proxies, Hibernate knows not to initialize the proxy when the "id getter" or the "id setter" is called because the proxy already contains the id value.

When using field access (in the extraction/injection sense) Hibernate has no idea which methods (if any) constitute the "id getter" and "id setter". The implication being that the proxy is initialized when the methods that are the id field accessors are called.

An "implicit solution" to this would be to infer the getter/setter method names based on the field name (make an assumption that JavaBeans naming is followed).

An "explicit solution" would be letting the user tell us which methods are id accessors.

Activity

Show:

Christian Beikov April 5, 2024 at 9:44 AM

Fwiw, during the creation of the ProxyFactory in org.hibernate.metamodel.internal.EntityRepresentationStrategyPojoStandard#createProxyFactory we rely on the implicit solution at the moment, so if we want to work on this, that is the place to funnel the annotated methods to.

Details

Assignee

Reporter

Components

Priority

Created March 26, 2014 at 4:27 PM
Updated April 17, 2024 at 3:14 PM