Esempio n. 1
0
 public String getValueInSQL(DBContext ctx, Object value) {
   if (beanClass.isInstance(value)) {
     Object v = pkColumn.getValue(value);
     return pkColumn.getValueInSQL(ctx, v);
   } else {
     return pkColumn.getValueInSQL(ctx, value);
   }
 }
Esempio n. 2
0
 public void appendColumnValue(
     DBContext ctx, StringBuilder buffer, Object value, String seperator) {
   Object primitiveValue = null;
   if (value != null) {
     primitiveValue = pkColumn.getValue(value);
   }
   pkColumn.appendColumnValue(ctx, buffer, primitiveValue, seperator);
 }
Esempio n. 3
0
    @SuppressWarnings("unchecked")
    protected void setListValue(Object obj) {
      List<T> list = null;

      DBCondition condition = fkColumn.equalsTo(obj);
      if (preFetch) {
        list = dao.query(DBContext.getContext(), condition);
      } else {
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(ArrayList.class);
        enhancer.setCallback(new DBListProxy<T>(obj, beanClass, getFieldName(), condition));
        list = (List<T>) enhancer.create();
      }
      try {
        FieldUtils.writeField(obj, getFieldName(), list, true);
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
    }
Esempio n. 4
0
 public String getTypeInSQL(DBContext ctx) {
   return pkColumn.getTypeInSQL(ctx);
 }
Esempio n. 5
0
    public void validate(Object obj) throws DBException {
      if (obj == null) return;

      Object value = getValue(obj);
      pkColumn.validate(value);
    }