public Integer create(Resource newResource) {
int columnType = newResource.getIdIndex().getColumnInfo().getColumnType();
Object[] parameters = new Object[] { newResource.getName(), newResource.getPartitionDimension().getId(), JdbcTypeMapper.jdbcTypeToString(columnType),newResource.isPartitioningResource()};
KeyHolder generatedKey = new GeneratedKeyHolder();
JdbcTemplate j = getJdbcTemplate();
PreparedStatementCreatorFactory creatorFactory = new PreparedStatementCreatorFactory(
"INSERT INTO resource_metadata (name,dimension_id,db_type,is_partitioning_resource) VALUES (?,?,?,?)",
new int[] {Types.VARCHAR,Types.INTEGER,Types.VARCHAR,Types.BIT});
creatorFactory.setReturnGeneratedKeys(true);
int rows = j.update(creatorFactory
.newPreparedStatementCreator(parameters), generatedKey);
if (rows != 1)
throw new HiveRuntimeException("Unable to create Resource: "
+ parameters);
if (generatedKey.getKeyList().size() == 0)