Examples of FieldType


Examples of com.j256.ormlite.field.FieldType

   * {@link #escapeValue(StringBuilder, String)} methods and should have any column names escaped using the
   * {@link #escapeColumnName(String)} or {@link #escapeColumnName(StringBuilder, String)} methods.
   * </p>
   */
  public StatementBuilder<T, ID> updateColumnExpression(String columnName, String expression) throws SQLException {
    FieldType fieldType = verifyColumnName(columnName);
    if (fieldType.isForeignCollection()) {
      throw new SQLException("Can't update foreign colletion field: " + columnName);
    }
    addUpdateColumnToList(columnName, new SetExpression(columnName, fieldType, expression));
    return this;
  }
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

      for (FieldType fieldType : fieldTypes) {
        map.put(fieldType.getDbColumnName(), fieldType);
      }
      fieldNameMap = map;
    }
    FieldType fieldType = fieldNameMap.get(columnName);
    // if column name is not found
    if (fieldType == null) {
      // look to see if someone is using the field-name instead of column-name
      for (FieldType fieldType2 : fieldTypes) {
        if (fieldType2.getFieldName().equals(columnName)) {
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

   * Return the array of field objects pulled from the data object.
   */
  protected Object[] getFieldObjects(Object data) throws SQLException {
    Object[] objects = new Object[argFieldTypes.length];
    for (int i = 0; i < argFieldTypes.length; i++) {
      FieldType fieldType = argFieldTypes[i];
      objects[i] = fieldType.extractJavaFieldToSqlArgValue(data);
      if (objects[i] == null && fieldType.getDefaultValue() != null) {
        objects[i] = fieldType.getDefaultValue();
      }
    }
    return objects;
  }
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

        sb.append(",");
      }
      sb.append("?");
    }
    sb.append(")");
    FieldType idField = tableInfo.getIdField();
    String queryNext = buildQueryNextSequence(databaseType, idField);
    return new MappedCreate<T, ID>(tableInfo, sb.toString(), argFieldTypes, queryNext);
  }
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

        tableInfo.getFieldTypes(), "query-for-id");
  }

  protected static <T, ID> String buildStatement(DatabaseType databaseType, TableInfo<T, ID> tableInfo)
      throws SQLException {
    FieldType idField = tableInfo.getIdField();
    if (idField == null) {
      throw new SQLException("Cannot query-for-id with " + tableInfo.getDataClass()
          + " because it doesn't have an id field");
    }
    // build the select statement by hand
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

    super(tableInfo, statement, argFieldTypes);
  }

  public static <T, ID> MappedUpdate<T, ID> build(DatabaseType databaseType, TableInfo<T, ID> tableInfo)
      throws SQLException {
    FieldType idField = tableInfo.getIdField();
    if (idField == null) {
      throw new SQLException("Cannot update " + tableInfo.getDataClass() + " because it doesn't have an id field");
    }
    if (tableInfo.getFieldTypes().length == 1) {
      throw new SQLException("Cannot update " + tableInfo.getDataClass()
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

   * NOTE: Use of this means that the resulting objects may not have a valid ID column value so cannot be deleted or
   * updated.
   * </p>
   */
  public QueryBuilder<T, ID> groupBy(String columnName) {
    FieldType fieldType = verifyColumnName(columnName);
    if (fieldType.isForeignCollection()) {
      throw new IllegalArgumentException("Can't groupBy foreign colletion field: " + columnName);
    }
    if (groupByList == null) {
      groupByList = new ArrayList<String>();
    }
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

   */
  public static <T> FieldType extractIdFieldType(ConnectionSource connectionSource, Class<T> clazz, String tableName)
      throws SQLException {
    for (Class<?> classWalk = clazz; classWalk != null; classWalk = classWalk.getSuperclass()) {
      for (Field field : classWalk.getDeclaredFields()) {
        FieldType fieldType = FieldType.createFieldType(connectionSource, tableName, field, clazz);
        if (fieldType != null
            && (fieldType.isId() || fieldType.isGeneratedId() || fieldType.isGeneratedIdSequence())) {
          return fieldType;
        }
      }
    }
    return null;
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

  /**
   * Add "ORDER BY" clause to the SQL query statement.
   */
  public QueryBuilder<T, ID> orderBy(String columnName, boolean ascending) {
    FieldType fieldType = verifyColumnName(columnName);
    if (fieldType.isForeignCollection()) {
      throw new IllegalArgumentException("Can't orderBy foreign colletion field: " + columnName);
    }
    if (orderByList == null) {
      orderByList = new ArrayList<OrderBy>();
    }
View Full Code Here

Examples of com.j256.ormlite.field.FieldType

    }
    appendOffset(sb);
  }

  private void addSelectColumnToList(String columnName) {
    FieldType fieldType = verifyColumnName(columnName);
    if (fieldType.isForeignCollection()) {
      throw new IllegalArgumentException("Can't select from foreign colletion field: " + columnName);
    }
    selectColumnList.add(columnName);
  }
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.