Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import java.util.Optional;
import java.util.stream.Stream;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jspecify.annotations.Nullable;

import org.springframework.dao.EmptyResultDataAccessException;
Expand Down Expand Up @@ -72,8 +70,6 @@
*/
public class DefaultDataAccessStrategy implements DataAccessStrategy {

private final Log logger = LogFactory.getLog(getClass());

private final SqlGeneratorSource sqlGeneratorSource;
private final RelationalMappingContext context;
private final JdbcConverter converter;
Expand Down Expand Up @@ -155,11 +151,8 @@ public NamedParameterJdbcOperations getJdbcOperations() {
public <S> boolean update(S objectToSave, Class<S> domainType) {

SqlIdentifierParameterSource parameterSource = parametersFactory.forUpdate(objectToSave, domainType);
if (parameterSource.size() <= 1) {
return true; // returning true, because conceptually the one row was correctly updated
}

return operations.update(sql(domainType).getUpdate(), parameterSource) != 0;
return parameterSource.size() <= 1 // returning true, because conceptually the one row was correctly updated
|| operations.update(sql(domainType).getUpdate(), parameterSource) != 0;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,25 +266,6 @@ private void readEntity(RS row, RowDocument document, AggregatePath basePath,
}
}

/**
* Read properties of embedded from the result set and store them under their column names
*/
private void collectEmbeddedValues(RS row, RowDocument document, RelationalPersistentProperty property,
AggregatePath path) {

RelationalPersistentEntity<?> embeddedHolder = aggregateContext.getRequiredPersistentEntity(property);
for (RelationalPersistentProperty embeddedProperty : embeddedHolder) {

if (embeddedProperty.isQualified() || embeddedProperty.isCollectionLike() || embeddedProperty.isEntity()) {
// hell, no!
throw new UnsupportedOperationException("Reading maps and collections into embeddable isn't supported yet");
}

AggregatePath nested = path.append(embeddedProperty);
aggregateContext.collectValue(row, nested, document, nested.getColumnInfo().name());
}
}

@Override
boolean hasResult() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class ExpressionEvaluatingParameterBinder {
*
* @param bindTarget must not be {@literal null}.
* @param parameterAccessor must not be {@literal null}.
* @param evaluator must not be {@literal null}.
*/
void bind(BindTarget bindTarget,
RelationalParameterAccessor parameterAccessor, ValueEvaluationContext evaluationContext) {
Expand Down Expand Up @@ -110,7 +109,7 @@ private void bindParameters(BindTarget bindSpec,

Optional<String> name = bindableParameter.getName();

if (name.isPresent() && (isNamedParameterReferencedFromQuery(name)) || !expressionQuery.getBindings().isEmpty()) {
if (name.isPresent() && isNamedParameterReferencedFromQuery(name) || !expressionQuery.getBindings().isEmpty()) {

if (!isNamedParameterReferencedFromQuery(name)) {
continue;
Expand Down Expand Up @@ -148,7 +147,7 @@ private org.springframework.r2dbc.core.Parameter getBindValue(org.springframewor

private boolean isNamedParameterReferencedFromQuery(Optional<String> name) {

if (!name.isPresent()) {
if (name.isEmpty()) {
return false;
}

Expand Down
Loading