Java 类org.hibernate.tuple.entity.EntityMetamodel 实例源码

项目:engerek    文件:RUtil.java   
private static void fixCompositeIdentifierInMetaModel(SessionFactory sessionFactory, Class clazz) {
    ClassMetadata classMetadata = sessionFactory.getClassMetadata(clazz);
    if (classMetadata instanceof AbstractEntityPersister) {
        AbstractEntityPersister persister = (AbstractEntityPersister) classMetadata;
        EntityMetamodel model = persister.getEntityMetamodel();
        IdentifierProperty identifier = model.getIdentifierProperty();

        try {
            Field field = IdentifierProperty.class.getDeclaredField("hasIdentifierMapper");
            field.setAccessible(true);
            field.set(identifier, true);
            field.setAccessible(false);
        } catch (Exception ex) {
            throw new SystemException("Attempt to fix entity meta model with hack failed, reason: "
                    + ex.getMessage(), ex);
        }
    }
}
项目:midpoint    文件:RUtil.java   
private static void fixCompositeIdentifierInMetaModel(SessionFactory sessionFactory, Class clazz) {
    ClassMetadata classMetadata = sessionFactory.getClassMetadata(clazz);
    if (classMetadata instanceof AbstractEntityPersister) {
        AbstractEntityPersister persister = (AbstractEntityPersister) classMetadata;
        EntityMetamodel model = persister.getEntityMetamodel();
        IdentifierProperty identifier = model.getIdentifierProperty();

        try {
            Field field = IdentifierProperty.class.getDeclaredField("hasIdentifierMapper");
            field.setAccessible(true);
            field.set(identifier, true);
            field.setAccessible(false);
        } catch (Exception ex) {
            throw new SystemException("Attempt to fix entity meta model with hack failed, reason: "
                    + ex.getMessage(), ex);
        }
    }
}
项目:midpoint    文件:RUtil.java   
private static void fixCompositeIdentifierInMetaModel(SessionFactory sessionFactory, Class clazz) {
    ClassMetadata classMetadata = sessionFactory.getClassMetadata(clazz);
    if (classMetadata instanceof AbstractEntityPersister) {
        AbstractEntityPersister persister = (AbstractEntityPersister) classMetadata;
        EntityMetamodel model = persister.getEntityMetamodel();
        IdentifierProperty identifier = model.getIdentifierProperty();

        try {
            Field field = IdentifierProperty.class.getDeclaredField("hasIdentifierMapper");
            field.setAccessible(true);
            field.set(identifier, true);
            field.setAccessible(false);
        } catch (Exception ex) {
            throw new SystemException("Attempt to fix entity meta model with hack failed, reason: "
                    + ex.getMessage(), ex);
        }
    }
}
项目:openbravo-brazil    文件:OBDynamicTuplizer.java   
public OBDynamicTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
  super(entityMetamodel, mappedEntity);
  log.debug("Created tuplizer for "
      + (mappedEntity.getMappedClass() != null ? mappedEntity.getMappedClass().getName()
          : mappedEntity.getEntityName()));
  persistentClass = mappedEntity;
}
项目:cacheonix-core    文件:PojoEntityTuplizer.java   
public PojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
        super( entityMetamodel, mappedEntity );
        this.mappedClass = mappedEntity.getMappedClass();
        this.proxyInterface = mappedEntity.getProxyInterface();
        this.lifecycleImplementor = Lifecycle.class.isAssignableFrom( mappedClass );
        this.validatableImplementor = Validatable.class.isAssignableFrom( mappedClass );

        Iterator iter = mappedEntity.getPropertyClosureIterator();
        while ( iter.hasNext() ) {
            Property property = (Property) iter.next();
            if ( property.isLazy() ) {
                lazyPropertyNames.add( property.getName() );
            }
        }

        String[] getterNames = new String[propertySpan];
        String[] setterNames = new String[propertySpan];
        Class[] propTypes = new Class[propertySpan];
        for ( int i = 0; i < propertySpan; i++ ) {
            getterNames[i] = getters[i].getMethodName();
            setterNames[i] = setters[i].getMethodName();
            propTypes[i] = getters[i].getReturnType();
        }

        if ( hasCustomAccessors || !Environment.useReflectionOptimizer() ) {
            optimizer = null;
        }
        else {
            // todo : YUCK!!!
            optimizer = Environment.getBytecodeProvider().getReflectionOptimizer( mappedClass, getterNames, setterNames, propTypes );
//          optimizer = getFactory().getSettings().getBytecodeProvider().getReflectionOptimizer(
//                  mappedClass, getterNames, setterNames, propTypes
//          );
        }

    }
项目:iso21090    文件:PartCollectionEntityTuplizer.java   
/**
 * Default constructor. 
 * @param entityModel entity model class
 * @param persistentClass persistent class
 */
public PartCollectionEntityTuplizer(EntityMetamodel entityModel, PersistentClass persistentClass) {
    super(entityModel, persistentClass);
    propertyNames = new String[propertySpan];

    Iterator propertiesIterator = persistentClass.getPropertyIterator();

    int count = 0;
    while (propertiesIterator.hasNext()) {
        propertyNames[count++] = ((Property) propertiesIterator.next()).getName();
    }
}
项目:lams    文件:AbstractEntityPersister.java   
public EntityMetamodel getEntityMetamodel() {
    return entityMetamodel;
}
项目:lams    文件:AbstractEntityPersister.java   
private void collectAttributeDefinitions(
        Map<String,AttributeDefinition> attributeDefinitionsByName,
        EntityMetamodel metamodel) {
    for ( int i = 0; i < metamodel.getPropertySpan(); i++ ) {
        final AttributeDefinition attributeDefinition = metamodel.getProperties()[i];
        // Don't replace an attribute definition if it is already in attributeDefinitionsByName
        // because the new value will be from a subclass.
        final AttributeDefinition oldAttributeDefinition = attributeDefinitionsByName.get(
                attributeDefinition.getName()
        );
        if ( oldAttributeDefinition != null ) {
            if ( LOG.isTraceEnabled() ) {
                    LOG.tracef(
                            "Ignoring subclass attribute definition [%s.%s] because it is defined in a superclass ",
                            entityMetamodel.getName(),
                            attributeDefinition.getName()
                    );
            }
        }
        else {
            attributeDefinitionsByName.put( attributeDefinition.getName(), attributeDefinition );
        }
    }

    // see if there are any subclass persisters...
    final Set<String> subClassEntityNames = metamodel.getSubclassEntityNames();
    if ( subClassEntityNames == null ) {
        return;
    }

    // see if we can find the persisters...
    for ( String subClassEntityName : subClassEntityNames ) {
        if ( metamodel.getName().equals( subClassEntityName ) ) {
            // skip it
            continue;
        }
        try {
            final EntityPersister subClassEntityPersister = factory.getEntityPersister( subClassEntityName );
            collectAttributeDefinitions( attributeDefinitionsByName, subClassEntityPersister.getEntityMetamodel() );
        }
        catch (MappingException e) {
            throw new IllegalStateException(
                    String.format(
                            "Could not locate subclass EntityPersister [%s] while processing EntityPersister [%s]",
                            subClassEntityName,
                            metamodel.getName()
                    ),
                    e
            );
        }
    }
}
项目:Layer-Query    文件:DinamicEntityPersister.java   
@Override
public EntityMetamodel getEntityMetamodel() {
    // TODO Auto-generated method stub
    return null;
}
项目:openbravo-brazil    文件:OBTuplizer.java   
public OBTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
  super(entityMetamodel, mappedEntity);
  log.debug("Created tuplizer for "
      + (mappedEntity.getMappedClass() != null ? mappedEntity.getMappedClass().getName()
          : mappedEntity.getEntityName()));
}
项目:gorm-hibernate5    文件:GroovyAwarePojoEntityTuplizer.java   
public GroovyAwarePojoEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
    super(entityMetamodel, mappedEntity);
}
项目:cacheonix-core    文件:AbstractEntityPersister.java   
public EntityMetamodel getEntityMetamodel() {
    return entityMetamodel;
}
项目:cacheonix-core    文件:CustomPersister.java   
public EntityMetamodel getEntityMetamodel() {
    return null;
}
项目:cacheonix-core    文件:MyEntityTuplizer.java   
public MyEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
    super( entityMetamodel, mappedEntity );
}
项目:Lucee4    文件:AbstractEntityTuplizerImpl.java   
public AbstractEntityTuplizerImpl(EntityMetamodel entityMetamodel, PersistentClass persistentClass) {
    super(entityMetamodel, persistentClass);
}
项目:breeze.server.java    文件:HibernateMetadata.java   
/**
 * Add the metadata for an entity.
 * 
 * @param meta
 */
void addClass(ClassMetadata meta) {
    Class type = meta.getMappedClass();

    String classKey = getEntityTypeName(type);
    HashMap<String, Object> cmap = new LinkedHashMap<String, Object>();
    _typeList.add(cmap);

    cmap.put("shortName", type.getSimpleName());
    cmap.put("namespace", type.getPackage().getName());

    EntityMetamodel metaModel = ((EntityPersister) meta).getEntityMetamodel();
    String superTypeName = metaModel.getSuperclass();
    if (superTypeName != null) {
        ClassMetadata superMeta = _sessionFactory.getClassMetadata(superTypeName);
        if (superMeta != null) {
            Class superClass = superMeta.getMappedClass();
            cmap.put("baseTypeName", getEntityTypeName(superClass));
        }
    }

    String genType = "None";
    if (meta instanceof EntityPersister) {
        EntityPersister entityPersister = (EntityPersister) meta;
        // multipart keys can never have an AutoGeneratedKeyType
        if (entityPersister.hasIdentifierProperty()) {
            IdentifierGenerator generator = entityPersister != null
                    ? entityPersister.getIdentifierGenerator()
                    : null;
            if (generator != null) {
                if (generator instanceof IdentityGenerator) {
                    genType = "Identity";
                } else if (generator instanceof Assigned || generator instanceof ForeignGenerator) {
                    genType = "None";
                } else {
                    genType = "KeyGenerator";
                }
                // TODO find the real generator
            }
        }
    }
    cmap.put("autoGeneratedKeyType", genType);

    String resourceName = pluralize(type.getSimpleName()); // TODO find the real name
    cmap.put("defaultResourceName", resourceName);
    _resourceMap.put(resourceName, classKey);

    ArrayList<HashMap<String, Object>> dataArrayList = new ArrayList<HashMap<String, Object>>();
    cmap.put("dataProperties", dataArrayList);
    ArrayList<HashMap<String, Object>> navArrayList = new ArrayList<HashMap<String, Object>>();
    cmap.put("navigationProperties", navArrayList);

    addClassProperties(meta, dataArrayList, navArrayList);
}
项目:query-utils    文件:OptionAwarePojoEntityTuplizer.java   
public OptionAwarePojoEntityTuplizer(EntityMetamodel emm, EntityBinding eb) {
  super(emm, eb);
}
项目:query-utils    文件:OptionAwarePojoEntityTuplizer.java   
public OptionAwarePojoEntityTuplizer(EntityMetamodel emm, PersistentClass pc) {
  super(emm, pc);
}
项目:lams    文件:EntityPersister.java   
/**
 * Retrieve the underlying entity metamodel instance...
 *
 *@return The metamodel
 */
public EntityMetamodel getEntityMetamodel();
项目:cacheonix-core    文件:EntityPersister.java   
/**
 * Retrieve the underlying entity metamodel instance...
 *
 *@return The metamodel
 */
public EntityMetamodel getEntityMetamodel();
项目:jspresso-ce    文件:DynamicPojoEntityTuplizer.java   
/**
 * Constructs a new {@code ProxyPojoEntityTuplizer} instance.
 *
 * @param entityMetamodel
 *          the entity meta model.
 * @param mappedEntity
 *          the mapped entity.
 */
public DynamicPojoEntityTuplizer(EntityMetamodel entityMetamodel,
    PersistentClass mappedEntity) {
  super(entityMetamodel, mappedEntity);
  fixPropertyAccessors(mappedEntity);
}
项目:iso21090    文件:IsoCustomEntityTuplizer.java   
/**
 * Default constructor.
 * @param entityModel entityMetaModel
 * @param persistentClass persistentClass
 */
public IsoCustomEntityTuplizer(EntityMetamodel entityModel, PersistentClass persistentClass) {
    super(entityModel, persistentClass);
}