fix a bug in @Query handling
add a test for empty query string in @Query Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
39f09aecae
commit
e829a01aee
|
@ -1,8 +1,13 @@
|
|||
package org.hibernate.processor.test.data.eg;
|
||||
|
||||
import jakarta.data.repository.BasicRepository;
|
||||
import jakarta.data.repository.Query;
|
||||
import jakarta.data.repository.Repository;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Repository
|
||||
public interface Publishers extends BasicRepository<Publisher,Long> {
|
||||
@Query(" ")
|
||||
Stream<Publisher> all();
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ import static org.hibernate.grammars.hql.HqlLexer.HAVING;
|
|||
import static org.hibernate.grammars.hql.HqlLexer.IDENTIFIER;
|
||||
import static org.hibernate.grammars.hql.HqlLexer.ORDER;
|
||||
import static org.hibernate.grammars.hql.HqlLexer.WHERE;
|
||||
import static org.hibernate.internal.util.StringHelper.isNotEmpty;
|
||||
import static org.hibernate.internal.util.StringHelper.isEmpty;
|
||||
import static org.hibernate.internal.util.StringHelper.qualify;
|
||||
import static org.hibernate.processor.annotation.AbstractQueryMethod.isSessionParameter;
|
||||
import static org.hibernate.processor.annotation.AbstractQueryMethod.isSpecialParam;
|
||||
|
@ -2143,7 +2143,7 @@ public class AnnotationMetaEntity extends AnnotationMeta {
|
|||
throw new AssertionFailure("@Entity annotation should not be missing");
|
||||
}
|
||||
final String name = (String) getAnnotationValue(annotation, "name");
|
||||
return isNotEmpty(name) ? resultType.asElement().getSimpleName().toString() : name;
|
||||
return isEmpty(name) ? resultType.asElement().getSimpleName().toString() : name;
|
||||
}
|
||||
else if ( primaryEntity != null ) {
|
||||
return primaryEntity.getSimpleName().toString();
|
||||
|
|
Loading…
Reference in New Issue