HHH-17166 fix broken logic for inferring that @HQL method is a mutation
This commit is contained in:
parent
412217d011
commit
fad11299f3
|
@ -953,10 +953,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
containerType == null ? null : containerType.getQualifiedName().toString(),
|
||||
paramNames,
|
||||
paramTypes,
|
||||
// update/delete/insert query methods must return int or void
|
||||
returnType != null
|
||||
&& returnType.getKind() != TypeKind.DECLARED
|
||||
&& returnType.getKind() != TypeKind.ARRAY,
|
||||
isInsertUpdateDelete( hql ),
|
||||
isNative,
|
||||
dao,
|
||||
sessionType[0],
|
||||
|
@ -976,6 +973,14 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean isInsertUpdateDelete(String hql) {
|
||||
final String trimmed = hql.trim();
|
||||
final String keyword = trimmed.length() > 6 ? trimmed.substring(0, 6) : "";
|
||||
return keyword.equalsIgnoreCase("update")
|
||||
|| keyword.equalsIgnoreCase("delete")
|
||||
|| keyword.equalsIgnoreCase("insert");
|
||||
}
|
||||
|
||||
private void validateHql(
|
||||
ExecutableElement method,
|
||||
@Nullable TypeMirror returnType,
|
||||
|
|
Loading…
Reference in New Issue