Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:1.0.1
I've just discovered that accessing a proxy's identifier getter method is not performing as described in the Hibernate documentation:
Quote:
Certain operations do not require proxy initialization
* equals(), if the persistent class does not override equals()
* hashCode(), if the persistent class does not override hashCode()
* The identifier getter method
In fact, it's loading the record from the DB when the identifier getter is touched.
Is this behavior the result of the differences between the Java and DynamicProxy implementations of proxying? Has it been done deliberately, or it this a bug?
I've noticed that there's a GetIdentifier method on the Session object, but this tests to see whether the session is open, so the identifier for a disconnected proxy can't be obtained. Also, I've found the NHibernateProxyHelper.GetIdentifier method, but it's asking for the IClassPersister for the object, and I don't know what it is, so I've been unable to use it so far.
Is there another way to do this that will allow you to access the identifier for a proxy regardless of whether or not it's associated with a session?
Cheers,
Symon.