@Override public Object instantiate(Object parent, SharedSessionContractImplementor session) throws HibernateException { final boolean useParent = parent != null && //TODO: Yuck! This is not quite good enough, it's a quick //hack around the problem of having a to-one association //that refers to an embedded component: super.getReturnedClass().isInstance( parent ); return useParent ? parent : super.instantiate( parent, session ); } }
@Override public int getPropertyIndex(String name) { String[] names = getPropertyNames(); for ( int i = 0, max = names.length; i < max; i++ ) { if ( names[i].equals( name ) ) { return i; } } throw new PropertyNotFoundException( "Unable to locate property named " + name + " on " + getReturnedClass().getName() ); }
protected ComponentTypeV2Adapter(final org.hibernate.type.ComponentType type) throws net.sf.hibernate.MappingException { super(type.getReturnedClass(), new String[0], null, null, true, null, null, null, null); this.type = type; this.impl = new CompositeTypeV2Adapter(type); }
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException { final boolean useParent = parent!=null && //TODO: Yuck! This is not quite good enough, it's a quick //hack around the problem of having a to-one association //that refers to an embedded component: super.getReturnedClass().isInstance(parent); return useParent ? parent : super.instantiate(parent, session); } }
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException { final boolean useParent = parent!=null && //TODO: Yuck! This is not quite good enough, it's a quick //hack around the problem of having a to-one association //that refers to an embedded component: super.getReturnedClass().isInstance(parent); return useParent ? parent : super.instantiate(parent, session); } }
/** * {@inheritDoc} */ @Override public String getDisplayText() { return "ComponentJoin{path=" + getComponentPath() + ", type=" + componentType.getReturnedClass() + "}"; }
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException { final boolean useParent = parent!=null && //TODO: Yuck! This is not quite good enough, its a quick //hack around the problem of having a to-one association //that refers to an embedded component: super.getReturnedClass().isInstance(parent); return useParent ? parent : super.instantiate(parent, session); } }
public Object instantiate(Object parent, SessionImplementor session) throws HibernateException { final boolean useParent = parent!=null && //TODO: Yuck! This is not quite good enough, it's a quick //hack around the problem of having a to-one association //that refers to an embedded component: super.getReturnedClass().isInstance(parent); return useParent ? parent : super.instantiate(parent, session); } }
/** * {@inheritDoc} */ @Override public String getDisplayText() { return "ComponentJoin{path=" + getComponentPath() + ", type=" + componentType.getReturnedClass() + "}"; }
public int getPropertyIndex(String name) { String[] names = getPropertyNames(); for ( int i = 0, max = names.length; i < max; i++ ) { if ( names[i].equals( name ) ) { return i; } } throw new PropertyNotFoundException( "Unable to locate property named " + name + " on " + getReturnedClass().getName() ); } }
public int getPropertyIndex(String name) { String[] names = getPropertyNames(); for ( int i = 0, max = names.length; i < max; i++ ) { if ( names[i].equals( name ) ) { return i; } } throw new PropertyNotFoundException( "Unable to locate property named " + name + " on " + getReturnedClass().getName() ); } }
private ComponentType buildComponentType(SessionFactory sessionFactory, String entityName, String propertyName) { EntityType entityType = (EntityType) entityTypes.get(entityName); if (null != entityType) { Type propertyType = (Type) entityType.getPropertyTypes().get(propertyName); if (null != propertyType) { return (ComponentType) propertyType; } } ClassMetadata cm = sessionFactory.getClassMetadata(entityName); org.hibernate.type.ComponentType hcType = (org.hibernate.type.ComponentType) cm .getPropertyType(propertyName); String[] propertyNames = hcType.getPropertyNames(); ComponentType cType = new ComponentType(hcType.getReturnedClass()); Map<String, Type> propertyTypes = cType.getPropertyTypes(); for (int j = 0; j < propertyNames.length; j++) { org.hibernate.type.Type type = cm.getPropertyType(propertyName + "." + propertyNames[j]); if (type.isEntityType()) { propertyTypes.put(propertyNames[j], buildEntityType(sessionFactory, type.getName())); } else if (type.isComponentType()) { propertyTypes.put(propertyNames[j], buildComponentType(sessionFactory, entityName, propertyName + "." + propertyNames[j])); } else if (type.isCollectionType()) { propertyTypes.put( propertyNames[j], buildCollectionType(sessionFactory, defaultCollectionClass(type), entityName + "." + propertyName + "." + propertyNames[j])); } } return cType; }