Skip to content

Commit 24df225

Browse files
committed
fixes for UPDATE queries
1 parent c9b6986 commit 24df225

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractAnnotatedMethod.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected void handle(StringBuilder declaration, String handled, String rethrown
9494
declaration.append( "\n\t\t\t.onFailure(" )
9595
.append( annotationMetaEntity.importType( handled ) )
9696
.append( ".class)\n" )
97-
.append( "\t\t\t\t\t.transform((_ex) -> new " )
97+
.append( "\t\t\t\t\t.transform(_ex -> new " )
9898
.append( annotationMetaEntity.importType( rethrown ) )
9999
.append( "(_ex.getMessage(), _ex))" );
100100

tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/QueryMethod.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ boolean isNullable(int index) {
8080

8181
@Override
8282
boolean singleResult() {
83-
return containerType == null;
83+
return containerType == null && !isUpdate;
8484
}
8585

8686
@Override
@@ -150,11 +150,22 @@ && isUsingEntityManager() ) {
150150
private void execute(StringBuilder declaration, boolean unwrapped) {
151151
if ( isUpdate ) {
152152
declaration
153-
.append("\t\t\t")
154-
.append(".executeUpdate()");
155-
if ( "boolean".equals(returnTypeName) ) {
156-
declaration
157-
.append(" > 0");
153+
.append("\t\t\t.executeUpdate()");
154+
if ( isReactive() ) {
155+
if ( Void.class.getName().equals( returnTypeName ) ) {
156+
declaration
157+
.append( "\n\t\t\t.replaceWithVoid()" );
158+
}
159+
else if ( Boolean.class.getName().equals( returnTypeName ) ) {
160+
declaration
161+
.append( "\n\t\t\t.map(rows -> rows>0)" );
162+
}
163+
}
164+
else {
165+
if ( "boolean".equals( returnTypeName ) ) {
166+
declaration
167+
.append( " > 0" );
168+
}
158169
}
159170
}
160171
else {

0 commit comments

Comments
 (0)