Sets GenerationType.IDENTITY properties value.

@param entity the entity
@param rs the result set

@throws SQLException if something goes wrong.
513350
@SuppressWarnings("unchecked")
    protected void fillIdentityPrimaryKeys(Object entity, ResultSet rs) throws SQLException {
        BeanDesc beanDesc = beanDescFactory.getBeanDesc(entity.getClass());
        int size = beanDesc.getPropertyDescSize();

        for(int i=0; i < size; i++){
            PropertyDesc propertyDesc = beanDesc.getPropertyDesc(i);
            PrimaryKey primaryKey = propertyDesc.getAnnotation(PrimaryKey.class);
            if(primaryKey != null && primaryKey.generationType() == GenerationType.IDENTITY){
                if(rs.next()){
                    Class<?> propertyType = propertyDesc.getPropertyType();
                    @SuppressWarnings("rawtypes")
                    ValueType valueType = MirageUtil.getValueType(propertyType, propertyDesc, dialect, valueTypes);

                    if(valueType != null){
                         propertyDesc.setValue(entity, valueType.get(propertyType, rs, 1));
                    }
                }
            }
        }
    }
162210
@SuppressWarnings("unchecked")
    protected void setParameters(PreparedStatement stmt, PropertyDesc[] propDescs, Object entity) throws SQLException {
        for (int i = 0; i < propDescs.length; i++) {
            PropertyDesc propertyDesc = propDescs[i];
            if(propertyDesc == null /*|| propertyDesc.getValue(entity) == null*/){
                stmt.setObject(i + 1, null);
            } else {
                Class<?> propertType = propertyDesc.getPropertyType();
                @SuppressWarnings("rawtypes")
                ValueType valueType = MirageUtil.getValueType(propertType, propertyDesc, dialect, valueTypes);
                if(valueType != null){
                    valueType.set(propertType, stmt, propertyDesc.getValue(entity), i + 1);
                } else {
                    if(logger.isWarnEnabled()) {
                        logger.warn("valueType for " + propertType.getName() + " not found.");
                    }
                }
            }
        }
    }
777509
protected Object transformEntity(Entity entity) {
		PropertyColumn propertyColumn = (PropertyColumn) entity;
		JRDesignField field = new JRDesignField();
		ColumnProperty columnProperty = propertyColumn.getColumnProperty();
		field.setName(columnProperty.getProperty());
		field.setValueClassName(columnProperty.getValueClassName());
		
		log.debug("Transforming column: " + propertyColumn.getName() + ", property: " + columnProperty.getProperty() + " (" + columnProperty.getValueClassName() +") " );

		field.setDescription(propertyColumn.getFieldDescription()); //hack for XML data source
		for (String key : columnProperty.getFieldProperties().keySet()) {
			field.getPropertiesMap().setProperty(key, columnProperty.getFieldProperties().get(key));
		}
		return field;
	}
484494
public Object convertToDynamicBean(ResultSet rs) throws SQLException{
		ResultSetMetaData rsmd = rs.getMetaData();
		
		Map<String, ColumnMetaData> columnToPropertyMappings = createColumnToPropertyMappings(rsmd);
		
		Class<?> beanClass = reuseOrBuildBeanClass(rsmd, columnToPropertyMappings);
		BeanProcessor beanProcessor = new BeanProcessor(simpleColumnToPropertyMappings(columnToPropertyMappings));
		return beanProcessor.toBean(rs, beanClass);
	}
196121
private IEntityLock instanceFromResultSet(java.sql.ResultSet rs)
            throws SQLException, LockingException {
        Integer entityTypeID = rs.getInt(1);
        Class entityType = EntityTypesLocator.getEntityTypes().getEntityTypeFromID(entityTypeID);
        String key = rs.getString(2);
        int lockType = rs.getInt(3);
        Timestamp ts = rs.getTimestamp(4);
        String lockOwner = rs.getString(5);

        return newInstance(entityType, key, lockType, ts, lockOwner);
    }
57734
public void setProperty(String propertyId, Object value)
      throws XMLConfigurationException {

    // Xerces properties
    if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
      final int suffixLength = propertyId.length()
          - Constants.XERCES_PROPERTY_PREFIX.length();

      if (suffixLength == Constants.SYMBOL_TABLE_PROPERTY.length()
          && propertyId.endsWith(Constants.SYMBOL_TABLE_PROPERTY)) {
        fSymbolTable = (SymbolTable) value;
      } else if (suffixLength == Constants.ENTITY_RESOLVER_PROPERTY.length()
          && propertyId.endsWith(Constants.ENTITY_RESOLVER_PROPERTY)) {
        fResolver = (XMLEntityResolver) value;
      }
    }
  }
291619
public int update(Entity entity) throws SQLException {
		if (CollectionUtil.isEmpty(entity)) {
			return 0;
		}
		entity = fixEntity(entity);
		Object pk = entity.get(primaryKeyField);
		if (null == pk) {
			throw new SQLException(StrUtil.format("Please determine `{}` for update", primaryKeyField));
		}

		final Entity where = Entity.create(tableName).set(primaryKeyField, pk);
		final Entity record = (Entity) entity.clone();
		record.remove(primaryKeyField);

		return db.update(record, where);
	}
768942
public void createGenerator (Connection conn, String tableName, String columnName, int initValue)
        throws SQLException
    {
        if (initValue == 1) {
            return; // that's the default! yay, do nothing
        }

        String seqname = "\"" + tableName + "_" + columnName + "_seq\"";
        Statement stmt = conn.createStatement();
        try {
            stmt.executeQuery("select setval('" + seqname + "', " + initValue + ", false)");
        } finally {
            JDBCUtil.close(stmt);
        }
        log("Initial value of " + seqname  + " set to " + initValue + ".");
    }
1205968
public void setEntityTypes(java.util.Collection<EntityTypesListItem> entityTypes) {
        if (entityTypes == null) {
            this.entityTypes = null;
            return;
        }

        this.entityTypes = new java.util.ArrayList<EntityTypesListItem>(entityTypes);
    }
375626
private void setEntityIdValue(final Object entity, final BigDecimal id, final MappingColumn column) {
		Class<?> rawType = column.getJavaType().getRawType();
		if (int.class.equals(rawType) || Integer.class.equals(rawType)) {
			column.setValue(entity, id.intValue());
		} else if (long.class.equals(rawType) || Long.class.equals(rawType)) {
			column.setValue(entity, id.longValue());
		} else if (BigInteger.class.equals(rawType)) {
			column.setValue(entity, id.toBigInteger());
		} else if (BigDecimal.class.equals(rawType)) {
			column.setValue(entity, id);
		} else if (String.class.equals(rawType)) {
			column.setValue(entity, id.toPlainString());
		} else {
			throw new UroborosqlRuntimeException(
					"Column is not correct as ID type. column=" + column.getCamelName() + ", type=" + rawType);
		}
	}
561250
protected void processGeneratedValue(EntityTable entityTable, EntityColumn entityColumn, GeneratedValue generatedValue) {
        if ("JDBC".equals(generatedValue.generator())) {
            entityColumn.setIdentity(true);
            entityColumn.setGenerator("JDBC");
            entityTable.setKeyProperties(entityColumn.getProperty());
            entityTable.setKeyColumns(entityColumn.getColumn());
        } else {
            //允许通过generator来设置获取id的sql,例如mysql=CALL IDENTITY(),hsqldb=SELECT SCOPE_IDENTITY()
            //允许通过拦截器参数设置公共的generator
            if (generatedValue.strategy() == GenerationType.IDENTITY) {
                //mysql的自动增长
                entityColumn.setIdentity(true);
                if (!"".equals(generatedValue.generator())) {
                    String generator = null;
                    IdentityDialect identityDialect = IdentityDialect.getDatabaseDialect(generatedValue.generator());
                    if (identityDialect != null) {
                        generator = identityDialect.getIdentityRetrievalStatement();
                    } else {
                        generator = generatedValue.generator();
                    }
                    entityColumn.setGenerator(generator);
                }
            } else {
                throw new MapperException(entityColumn.getProperty()
                        + " - 该字段@GeneratedValue配置只允许以下几种形式:" +
                        "\n1.useGeneratedKeys的@GeneratedValue(generator=\\\"JDBC\\\")  " +
                        "\n2.类似mysql数据库的@GeneratedValue(strategy=GenerationType.IDENTITY[,generator=\"Mysql\"])");
            }
        }
    }
232048
@SuppressWarnings("unchecked")
	@Override
	public <E> SqlEntityDelete<E> delete(final Class<? extends E> entityType) {
		@SuppressWarnings("rawtypes")
		EntityHandler handler = this.getEntityHandler();
		if (!handler.getEntityType().isAssignableFrom(entityType)) {
			throw new IllegalArgumentException("Entity type not supported");
		}

		try {
			TableMetadata metadata = handler.getMetadata(this.transactionManager, entityType);

			SqlContext context = handler.createDeleteContext(this, metadata, entityType, false);
			context.setSqlKind(SqlKind.DELETE);

			return new SqlEntityDeleteImpl<>(this, handler, metadata, context);
		} catch (SQLException e) {
			throw new EntitySqlRuntimeException(SqlKind.DELETE, e);
		}
	}
559263
@SuppressWarnings("unchecked")
	@Override
	public int delete(final Object entity) {
		@SuppressWarnings("rawtypes")
		EntityHandler handler = this.getEntityHandler();
		if (!handler.getEntityType().isInstance(entity)) {
			throw new IllegalArgumentException("Entity type not supported");
		}

		try {
			Class<?> type = entity.getClass();
			TableMetadata metadata = handler.getMetadata(this.transactionManager, type);
			SqlContext context = handler.createDeleteContext(this, metadata, type, true);
			context.setSqlKind(SqlKind.DELETE);
			handler.setDeleteParams(context, entity);
			return handler.doDelete(this, context, entity);
		} catch (SQLException e) {
			throw new EntitySqlRuntimeException(SqlKind.DELETE, e);
		}
	}
388820
public void setEntityTypes(java.util.Collection<EntityRecognizerMetadataEntityTypesListItem> entityTypes) {
        if (entityTypes == null) {
            this.entityTypes = null;
            return;
        }

        this.entityTypes = new java.util.ArrayList<EntityRecognizerMetadataEntityTypesListItem>(entityTypes);
    }
686278
@Override
	public E createRecord(final ResultSet rs) throws SQLException {
		try {
			if (columnLabels == null) {
				ResultSetMetaData rsmd = rs.getMetaData();
				columnCount = rsmd.getColumnCount();

				// columnLabelsは1始まりの配列で値を格納
				columnLabels = new String[columnCount + 1];
				for (int i = 1; i <= columnCount; i++) {
					columnLabels[i] = rsmd.getColumnLabel(i);
				}
			}

			E rec = constructor.newInstance();
			for (MappingColumn column : columns) {
				bindValue(rec, rs, column);
			}
			return rec;
		} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
			LOG.error("Error!!", e);
			throw new UroborosqlRuntimeException(e);
		} catch (SQLException | RuntimeException | Error e) {
			LOG.error("Error!!", e);
			throw e;
		}
	}
1258719
public static <T extends Collection<Entity>> T handleRs(ResultSet rs, T collection) throws SQLException {
		final ResultSetMetaData meta = rs.getMetaData();
		final int columnCount = meta.getColumnCount();

		while (rs.next()) {
			collection.add(HandleHelper.handleRow(columnCount, meta, rs));
		}

		return collection;
	}
1032449
public static Object getObject(final ResultSet rs,
                                   final String name,
                                   final ColumnType type) throws SQLException {
        
        switch (type) {
        case BigDecimal: return rs.getBigDecimal(name);
        case Boolean: return rs.getBoolean(name);
        case Byte: return rs.getByte(name);
        case Short: return rs.getShort(name);
        case Date: return rs.getDate(name);
        case Double: return rs.getDouble(name);
        case Float: return rs.getFloat(name);
        case Int: return rs.getInt(name);
        case Long: return rs.getLong(name);
        case Time: return rs.getTime(name);
        case Timestamp: return rs.getTimestamp(name);
        default: return rs.getString(name);
        }
    }