Examples of ORMConfigBean


Examples of org.eweb4j.orm.config.bean.ORMConfigBean

    Table tableAnn = clazz.getAnnotation(Table.class);
    String table = tableAnn == null ? "" : tableAnn.name();
    table = "".equals(table.trim()) ? clazz.getSimpleName()
        .replace("PO", "").replace("POJO", "").replace("Entity", "")
        .replace("Model", "") : table;
    ORMConfigBean ormBean = new ORMConfigBean();
    ormBean.setClazz(clazz.getName());
    ormBean.setId(clazz.getSimpleName());
    ormBean.setTable(table);

    List<Property> pList = getProperties(clazz, null, false);
    List<Property> superList = new ArrayList<Property>();
    Class<?> superClazz = clazz.getSuperclass();
    try {
      for (; superClazz != Object.class && superClazz != null; superClazz = superClazz
          .getSuperclass()) {
        if (!superClazz.isAnnotationPresent(MappedSuperclass.class))
          continue;
        List<Property> list = getProperties(superClazz, pList, true);
        if (list != null)
          superList.addAll(list);
      }
    } catch (Error er) {
      log.debug("the action class new instance failued -> " + clsName + " | " + er.toString());
      return false;
    } catch (Exception e) {
      log.debug("the action class new instance failued -> " + clsName + " | " + e.toString());
      return false;
    }
    List<Property> properties = new ArrayList<Property>(superList);
    properties.addAll(pList);

    ormBean.setProperty(properties);
    ORMConfigBeanCache.add(clazz, ormBean);

    return true;
  }
View Full Code Here

Examples of org.eweb4j.orm.config.bean.ORMConfigBean

import org.eweb4j.util.StringUtil;

public class ORMConfigBeanUtil {

  public static String[] getToOneField(Class<?> clazz){
    ORMConfigBean ormBean = ORMConfigBeanCache.get(clazz);
    if (ormBean == null)
      return null;
   
    List<String> list = new ArrayList<String>();
   
    for (Property p : ormBean.getProperty()) {
      if (PropType.ONE_ONE.equals(p.getType()) || PropType.MANY_ONE.equals(p.getType()))
        list.add(p.getName());
    }
   
    return list.toArray(new String[]{});
View Full Code Here

Examples of org.eweb4j.orm.config.bean.ORMConfigBean

      HashMap<String, Object> map = (HashMap<String, Object>) t;
      return (String) map.get("idColumn");
    }

    String pk = "id";
    ORMConfigBean ormBean = ORMConfigBeanCache.get(clazz);
    if (ormBean == null)
      return pk;

    for (Property property : ormBean.getProperty()) {
      if (("true".equals(property.getPk()) || "1"
          .equals(property.getPk()))
          && ("true".equals(property.getAutoIncrement()) || "1"
              .equals(property.getAutoIncrement()))) {
        if (1 == type)
View Full Code Here

Examples of org.eweb4j.orm.config.bean.ORMConfigBean

    if (!(t instanceof Class) && Map.class.isAssignableFrom(clazz)) {
      HashMap<String, Object> map = (HashMap<String, Object>) t;
      return (String) map.get("table");
    }

    ORMConfigBean ormBean = ORMConfigBeanCache.get(clazz);
    String table = ormBean == null ? clazz.getSimpleName() : ormBean
        .getTable();
    return table;
  }
View Full Code Here

Examples of org.eweb4j.orm.config.bean.ORMConfigBean

      strs = new String[] { "" };

    String[] result = strs.clone();
    List<String> list = new ArrayList<String>();

    ORMConfigBean ormBean = ORMConfigBeanCache.get(clazz);
    if (ormBean != null) {
      // String idColumn = getIdColumn(clazz);
      for (int i = 0; i < strs.length; i++) {
        boolean finished = false;
        List<Property> properties = ormBean.getProperty();
        for (Property p : properties) {
          if (finished)
            break;
          switch (type) {
          case 1:
View Full Code Here

Examples of org.eweb4j.orm.config.bean.ORMConfigBean

        return (List<T>) (_list.isEmpty() ? null : _list);
      } else {
        while (rs.next()) {
          t = cls.newInstance();
          ReflectUtil ru = new ReflectUtil(t);
          ORMConfigBean ormBean = ORMConfigBeanCache.get(cls);

          for (Iterator<Property> it = ormBean.getProperty()
              .iterator(); it.hasNext();) {
            Property p = it.next();
            String type = p.getType();
            if (type == null)
              continue;
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.