/** * Check if the property is initialized. If the named property does not exist or is not * persistent, this method always returns <tt>true</tt>. * * @param proxy The potential proxy * @param propertyName the name of a persistent attribute of the object * @return true if the named property of the object is not listed as uninitialized; false * otherwise */ public static boolean isPropertyInitialized(Object proxy, String propertyName) { Object entity; if (proxy instanceof HibernateProxy) { LazyInitializer li = ((HibernateProxy) proxy).getHibernateLazyInitializer(); if (li.isUninitialized()) { return false; } else { entity = li.getImplementation(); } } else { entity = proxy; } if (FieldInterceptionHelper.isInstrumented(entity)) { FieldInterceptor interceptor = FieldInterceptionHelper.extractFieldInterceptor(entity); return interceptor == null || interceptor.isInitialized(propertyName); } else { return true; } }