Examples of EntityType


Examples of org.beangle.model.entity.types.EntityType

    }
    return type;
  }

  public EntityType getEntityType(String entityName) {
    EntityType type = entityTypes.get(entityName);
    if (null != type) { return type; }
    type = classEntityTypes.get(entityName);
    // last try by it's interface
    if (null == type) {
      try {
        // FIXME
        Class<?> entityClass = Class.forName(entityName);
        if (Entity.class.isAssignableFrom(entityClass)) {
          type = new EntityType(entityClass);
        } else {
          logger.warn("{} 's is not entity", entityClass);
        }
      } catch (ClassNotFoundException e) {
        logger.error("system doesn't contains entity {}", entityName);
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

      String role) {
    CollectionMetadata cm = sessionFactory.getCollectionMetadata(role);
    // FIXME buildCollectionType
    if (null == cm) { return null; }
    org.hibernate.type.Type type = cm.getElementType();
    EntityType elementType = null;
    if (type.isEntityType()) {
      elementType = (EntityType) entityTypes.get(type.getName());
      if (null == elementType) {
        elementType = buildEntityType(sessionFactory, type.getName());
      }
    } else {
      elementType = new EntityType(type.getReturnedClass());
    }

    CollectionType collectionType = new CollectionType();
    collectionType.setElementType(elementType);
    collectionType.setArray(cm.isArray());
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    return collectionType;
  }

  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
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    if (!props.isEmpty()) {
      logger.info("Using model.properties initialize Entity Context.");
      for (Map.Entry<Object, Object> entry : props.entrySet()) {
        String key = (String) entry.getKey();
        String value = (String) entry.getValue();
        EntityType entityType = new EntityType();
        entityType.setEntityName(key);
        try {
          entityType.setEntityClass(Class.forName(value));
        } catch (ClassNotFoundException e) {
          logger.error(value + " was not correct class name", e);
        }
        entityType.setPropertyTypes(new HashMap<String, Type>());
        entityTypes.put(key, entityType);
      }
    }
  }
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    return query;
  }

  @SuppressWarnings("unchecked")
  public static <E> OqlBuilder<E> from(final String entityName, final String alias) {
    EntityType type = Model.getEntityType(entityName);
    OqlBuilder<E> query = new OqlBuilder<E>();
    query.entityClass = (Class<E>) type.getEntityClass();
    query.alias = alias;
    query.select = "select " + alias;
    query.from = concat("from ", entityName, " ", alias);
    return query;
  }
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    query.from = concat("from ", entityName, " ", alias);
    return query;
  }

  public static <E> OqlBuilder<E> from(final Class<E> entityClass) {
    EntityType type = Model.getEntityType(entityClass.getName());
    if (null == type) {
      type = Model.getEntityType(entityClass);
    }
    return from(entityClass, EntityUtils.getCommandName(type.getEntityName()));
  }
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    return from(entityClass, EntityUtils.getCommandName(type.getEntityName()));
  }

  @SuppressWarnings("unchecked")
  public static <E> OqlBuilder<E> from(final Class<E> entityClass, final String alias) {
    EntityType type = Model.getEntityType(entityClass.getName());
    if (null == type) {
      type = Model.getEntityType(entityClass);
    }
    OqlBuilder<E> query = new OqlBuilder<E>();
    query.entityClass = (Class<E>) type.getEntityClass();
    query.alias = alias;
    query.select = "select " + alias;
    query.from = concat("from ", type.getEntityName(), " ", alias);
    return query;
  }
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    super();
    this.statement = hql;
  }

  public EntityQuery(final String entityName, final String alias) {
    EntityType type = Model.getEntityType(entityName);
    this.entityClass = type.getEntityClass();
    this.alias = alias;
    select = "select " + alias + " ";
    from = "from " + entityName + " " + alias;
  }
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    from = "from " + entityName + " " + alias;
  }

  public EntityQuery(final Class<?> entityClass, final String alias) {
    super();
    EntityType type = Model.getEntityType(entityClass.getName());
    if (null == type) {
      type = Model.getEntityType(entityClass);
    }
    this.entityClass = type.getEntityClass();
    this.alias = alias;
    select = "select " + alias + " ";
    from = "from " + type.getEntityName() + " " + alias;
  }
View Full Code Here

Examples of org.beangle.model.entity.types.EntityType

    return entity;
  }

  @SuppressWarnings("unchecked")
  protected <T> T populateEntity(Class<T> entityClass, String shortName) {
    EntityType type = null;
    if (entityClass.isInterface()) {
      type = Model.getEntityType(entityClass.getName());
    } else {
      type = Model.getEntityType(entityClass);
    }
    return (T) populateEntity(type.getEntityName(), shortName);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.