public boolean isLazy() { if (value instanceof ToOne) { // both many-to-one and one-to-one are represented as a // Property. EntityPersister is relying on this value to // determine "lazy fetch groups" in terms of field-level // interception. So we need to make sure that we return // true here for the case of many-to-one and one-to-one // with lazy="no-proxy" // // * impl note - lazy="no-proxy" currently forces both // lazy and unwrap to be set to true. The other case we // are extremely interested in here is that of lazy="proxy" // where lazy is set to true, but unwrap is set to false. // thus we use both here under the assumption that this // return is really only ever used during persister // construction to determine the lazy property/field fetch // groupings. If that assertion changes then this check // needs to change as well. Partially, this is an issue with // the overloading of the term "lazy" here... ToOne toOneValue = (ToOne) value; return toOneValue.isLazy() && toOneValue.isUnwrapProxy(); } return lazy; }