Skip to content

Commit

Permalink
fixes for UPDATE queries
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Dec 20, 2024
1 parent c9b6986 commit 24df225
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ protected void handle(StringBuilder declaration, String handled, String rethrown
declaration.append( "\n\t\t\t.onFailure(" )
.append( annotationMetaEntity.importType( handled ) )
.append( ".class)\n" )
.append( "\t\t\t\t\t.transform((_ex) -> new " )
.append( "\t\t\t\t\t.transform(_ex -> new " )
.append( annotationMetaEntity.importType( rethrown ) )
.append( "(_ex.getMessage(), _ex))" );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ boolean isNullable(int index) {

@Override
boolean singleResult() {
return containerType == null;
return containerType == null && !isUpdate;
}

@Override
Expand Down Expand Up @@ -150,11 +150,22 @@ && isUsingEntityManager() ) {
private void execute(StringBuilder declaration, boolean unwrapped) {
if ( isUpdate ) {
declaration
.append("\t\t\t")
.append(".executeUpdate()");
if ( "boolean".equals(returnTypeName) ) {
declaration
.append(" > 0");
.append("\t\t\t.executeUpdate()");
if ( isReactive() ) {
if ( Void.class.getName().equals( returnTypeName ) ) {
declaration
.append( "\n\t\t\t.replaceWithVoid()" );
}
else if ( Boolean.class.getName().equals( returnTypeName ) ) {
declaration
.append( "\n\t\t\t.map(rows -> rows>0)" );
}
}
else {
if ( "boolean".equals( returnTypeName ) ) {
declaration
.append( " > 0" );
}
}
}
else {
Expand Down

0 comments on commit 24df225

Please sign in to comment.