We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spring-r2dbc:5.3.24
When using H2 together with spring-data-r2dbc (1.5.6) there is a class cast error when deleting row from database. This code fragment:
private static Mono<Integer> sumRowsUpdated( Function<Connection, Flux<Result>> resultFunction, Connection it) { return resultFunction.apply(it) .flatMap(Result::getRowsUpdated) .collect(Collectors.summingInt(Integer::intValue)); }
Is using integers but getRowsUpdated contains Long value
The text was updated successfully, but these errors were encountered:
I have update my project to the Java17 and to all latest dependencies and now it's fine
Sorry, something went wrong.
Because in version 3.xx, R2dbcEntityTemplate.doDelete(Query query, Class<?>entityClass) returns Mono<Long>
R2dbcEntityTemplate.doDelete(Query query, Class<?>entityClass)
Mono<Long>
in version 1.5.6 R2dbcEntityTemplate. doDelete is:
R2dbcEntityTemplate. doDelete
@Override public Mono<Integer> delete(Query query, Class<?> entityClass) throws DataAccessException { Assert.notNull(query, "Query must not be null"); Assert.notNull(entityClass, "Entity class must not be null"); return doDelete(query, entityClass, getTableName(entityClass)); } Mono<Integer> doDelete(Query query, Class<?> entityClass, SqlIdentifier tableName) { StatementMapper statementMapper = dataAccessStrategy.getStatementMapper().forType(entityClass); StatementMapper.DeleteSpec deleteSpec = statementMapper // .createDelete(tableName); Optional<CriteriaDefinition> criteria = query.getCriteria(); if (criteria.isPresent()) { deleteSpec = criteria.map(deleteSpec::withCriteria).orElse(deleteSpec); } PreparedOperation<?> operation = statementMapper.getMappedObject(deleteSpec); return this.databaseClient.sql(operation).fetch().rowsUpdated().defaultIfEmpty(0); }
in version 3.xx, R2dbcEntityTemplate. doDelete is:
@Override public Mono<Long> delete(Query query, Class<?> entityClass) throws DataAccessException { Assert.notNull(query, "Query must not be null"); Assert.notNull(entityClass, "Entity class must not be null"); return doDelete(query, entityClass, getTableName(entityClass)); } Mono<Long> doDelete(Query query, Class<?> entityClass, SqlIdentifier tableName) { StatementMapper statementMapper = dataAccessStrategy.getStatementMapper().forType(entityClass); StatementMapper.DeleteSpec deleteSpec = statementMapper // .createDelete(tableName); Optional<CriteriaDefinition> criteria = query.getCriteria(); if (criteria.isPresent()) { deleteSpec = criteria.map(deleteSpec::withCriteria).orElse(deleteSpec); } PreparedOperation<?> operation = statementMapper.getMappedObject(deleteSpec); return this.databaseClient.sql(operation).fetch().rowsUpdated().defaultIfEmpty(0L); }
No branches or pull requests
spring-r2dbc:5.3.24
When using H2 together with spring-data-r2dbc (1.5.6) there is a class cast error when deleting row from database.
This code fragment:
Is using integers but getRowsUpdated contains Long value
The text was updated successfully, but these errors were encountered: