Hibernate version:
3.0 rc 1
Problem description:
direct field access is not intercepted by cglib proxy. (ignore this post if this is a known limitation)
first an object of CustomLongClass is given a name and stored in the database. after retrieval of this object in a new session, the debugger shows that the retrieved object is a cglib proxy and that the fields are not yet initialized. when accessing the name field directly (it's a public field!), it does *not* get initialized. creating a getter method and accessing the property via the getter solves the problem.
Mapping document:
Code:
<hibernate-mapping default-access="field">
<class name="org.jbpm.context.exe.CustomLongClass">
<id name="id"><generator class="native" /></id>
<property name="name" />
</class>
</hibernate-mapping>
Class:Code:
public class CustomLongClass {
long id = 0;
public String name = null;
public CustomLongClass() {
}
}
regards, tom.