call to id getter initializes proxy when using AccessType( "field" )

Description

Calling getter for id when using AccessType( "field" ) causes proxy initialization.

In org.hibernate.proxy.proxy.pojo.BasicLazyInitializer there is the code

However, when using field access, the getIdentifierMethod will be null. I fixed this for us by changing DirectPropertyAccessor by adding a Method attribute to the DirectGetter inner class, and looking up the appropriate getter in the constructor. As far as I can tell, getMethod is only used in two places. In the above case, to the get the identity getter and in PojoComponentTupilizer.isMethodOf. This doesn't seem to break anything. I don't know if this is a clean solution, seems a little hacky to me, however, it would be great if the issue could be fixed somehow.

Environment

hibernate 3.3.1, hibernate annotations 3.4.0, running on windows, linux and solaris, using sybase 15

Status

Assignee

Strong Liu

Reporter

Paul Lorenz

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure