public Object instantiate(Object parent, SessionImplementor session) throws HibernateException { Object result = instantiate(entityMode); if (componentTuplizer.hasParentProperty() && parent != null) { componentTuplizer.setParent( result, session.getPersistenceContext().proxyFor(parent), session.getFactory()); } return result; }
public Object getPropertyValue(Object component, int i) throws HibernateException { if (component instanceof Object[]) { // A few calls to hashCode pass the property values already in an // Object[] (ex: QueryKey hash codes for cached queries). // It's easiest to just check for the condition here prior to // trying reflection. return ((Object[]) component)[i]; } else { return componentTuplizer.getPropertyValue(component, i); } }
@Override public Object deepCopy(Object component, SessionFactoryImplementor factory) throws HibernateException { if (component == null) { return null; } Object[] values = getPropertyValues(component, entityMode); for (int i = 0; i < propertySpan; i++) { values[i] = propertyTypes[i].deepCopy(values[i], factory); } Object result = instantiate(entityMode); setPropertyValues(result, values, entityMode); // not absolutely necessary, but helps for some // equals()/hashCode() implementations if (componentTuplizer.hasParentProperty()) { componentTuplizer.setParent(result, componentTuplizer.getParent(component), factory); } return result; }
/** This method does not populate the component parent */ public Object instantiate(EntityMode entityMode) throws HibernateException { return componentTuplizer.instantiate(); }
@Override public void setPropertyValues(Object component, Object[] values, EntityMode entityMode) throws HibernateException { componentTuplizer.setPropertyValues(component, values); }
public Class getReturnedClass() { return componentTuplizer.getMappedClass(); }