mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-22 11:06:08 +00:00
fix @Find method with varargs Order parameter
This commit is contained in:
parent
a7d57357d1
commit
2cfe93cd88
@ -15,6 +15,7 @@
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.hibernate.jpamodelgen.util.Constants.SESSION_TYPES;
|
||||
import static org.hibernate.jpamodelgen.util.TypeUtils.isPrimitive;
|
||||
|
||||
@ -69,6 +70,14 @@ public String getPropertyName() {
|
||||
|
||||
abstract boolean isNullable(int index);
|
||||
|
||||
List<String> parameterTypes() {
|
||||
return paramTypes.stream()
|
||||
.map(paramType -> isOrderParam(paramType) && paramType.endsWith("[]")
|
||||
? paramType.substring(0, paramType.length() - 2) + "..."
|
||||
: paramType)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
String parameterList() {
|
||||
return paramTypes.stream()
|
||||
.map(this::strip)
|
||||
|
@ -46,6 +46,7 @@ public boolean isNullable(int index) {
|
||||
|
||||
@Override
|
||||
public String getAttributeDeclarationString() {
|
||||
final List<String> paramTypes = parameterTypes();
|
||||
final StringBuilder declaration = new StringBuilder();
|
||||
comment( declaration );
|
||||
modifiers( declaration );
|
||||
|
@ -9,12 +9,9 @@
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.jpamodelgen.util.Constants;
|
||||
import org.hibernate.query.Order;
|
||||
import org.hibernate.query.Page;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.hibernate.jpamodelgen.util.StringUtil.getUpperUnderscoreCaseFromLowerCamelCase;
|
||||
|
||||
/**
|
||||
@ -205,14 +202,6 @@ else if ( returnTypeName != null ) {
|
||||
return type;
|
||||
}
|
||||
|
||||
private List<String> parameterTypes() {
|
||||
return paramTypes.stream()
|
||||
.map(paramType -> isOrderParam(paramType) && paramType.endsWith("[]")
|
||||
? paramType.substring(0, paramType.length() - 2) + "..."
|
||||
: paramType)
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
private void comment(StringBuilder declaration) {
|
||||
declaration
|
||||
.append("\n/**");
|
||||
|
@ -74,4 +74,10 @@ public interface Dao {
|
||||
|
||||
@Find
|
||||
List<Bean> beansForText(String text);
|
||||
|
||||
@HQL("where isbn = ?1")
|
||||
List<Book> sortedBooksForIsbn(String isbn, Order<? super Book>... order);
|
||||
|
||||
@Find
|
||||
List<Book> sortedBooks(String isbn, Order<? super Book>... order);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user