Skip to content

Commit d0b0c57

Browse files
committed
HHH-18953 fix error in implementation of multiarg lifecycle reactive repo methods
I messed this up yesterday
1 parent d104e7c commit d0b0c57

File tree

2 files changed

+38
-16
lines changed
  • tooling/metamodel-generator/src

2 files changed

+38
-16
lines changed

tooling/metamodel-generator/src/jakartaData/java/org/hibernate/processor/test/data/reactive/Library2.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ record BookWithAuthor(Book book, Author author) {}
9191
@Insert
9292
Uni<Publisher[]> insertAll(Publisher[] publishers);
9393

94+
@Delete
95+
Uni<Void> deleteAll(List<Publisher> publishers);
96+
9497
@Save
9598
Uni<Publisher> save(Publisher publisher);
9699

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

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private void delegateBlockingly(StringBuilder declaration) {
141141
.append(sessionName)
142142
.append('.')
143143
.append("insert");
144-
argument( declaration, "Multiple" );
144+
argument( declaration );
145145
declaration
146146
.append(";\n")
147147
.append("\t\telse\n\t");
@@ -151,28 +151,47 @@ private void delegateBlockingly(StringBuilder declaration) {
151151
.append(sessionName)
152152
.append('.')
153153
.append(operationName);
154-
argument( declaration, "Multiple" );
154+
argument( declaration );
155155
declaration
156156
.append(";\n");
157157
}
158158

159-
private void argument(StringBuilder declaration, String suffix) {
159+
private void argument(StringBuilder declaration) {
160160
switch ( parameterKind ) {
161161
case LIST:
162-
declaration
163-
.append(suffix)
164-
.append("(")
165-
.append(parameterName)
166-
.append(")");
162+
if ( isReactive() ) {
163+
declaration
164+
.append("All")
165+
.append("(")
166+
.append(parameterName)
167+
.append(".toArray()")
168+
.append( ")" );
169+
}
170+
else {
171+
declaration
172+
.append("Multiple")
173+
.append("(")
174+
.append(parameterName)
175+
.append(")");
176+
}
167177
break;
168178
case ARRAY:
169-
declaration
170-
.append(suffix)
171-
.append("(")
172-
.append(annotationMetaEntity.importType(LIST))
173-
.append(".of(")
174-
.append(parameterName)
175-
.append("))");
179+
if ( isReactive() ) {
180+
declaration
181+
.append("All")
182+
.append("(")
183+
.append(parameterName)
184+
.append(")");
185+
}
186+
else {
187+
declaration
188+
.append("Multiple")
189+
.append("(")
190+
.append(annotationMetaEntity.importType(LIST))
191+
.append(".of(")
192+
.append(parameterName)
193+
.append("))");
194+
}
176195
break;
177196
default:
178197
declaration
@@ -212,7 +231,7 @@ private void delegateReactively(StringBuilder declaration) {
212231
.append( '.' )
213232
.append( operationName );
214233
// note that there is no upsertAll() method
215-
argument( declaration, "All" );
234+
argument( declaration );
216235
if ( isGeneratedIdUpsert() ) {
217236
declaration
218237
.append(')');

0 commit comments

Comments
 (0)