示例#1
0
  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;
  }
示例#2
0
 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);
   }
 }
示例#3
0
  @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;
  }
示例#4
0
 /** This method does not populate the component parent */
 public Object instantiate(EntityMode entityMode) throws HibernateException {
   return componentTuplizer.instantiate();
 }
示例#5
0
 @Override
 public void setPropertyValues(Object component, Object[] values, EntityMode entityMode)
     throws HibernateException {
   componentTuplizer.setPropertyValues(component, values);
 }
示例#6
0
 public Class getReturnedClass() {
   return componentTuplizer.getMappedClass();
 }