HHH-16814 add getRootList()
The method getRoots() returning a Set is really inconvenient
This commit is contained in:
parent
95bcd9460f
commit
3c2d4f9616
|
@ -13,6 +13,7 @@ import jakarta.persistence.criteria.Expression;
|
|||
import jakarta.persistence.criteria.Order;
|
||||
import jakarta.persistence.criteria.ParameterExpression;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
import jakarta.persistence.criteria.Selection;
|
||||
import jakarta.persistence.metamodel.EntityType;
|
||||
|
||||
|
@ -49,6 +50,11 @@ public interface JpaCriteriaQuery<T> extends CriteriaQuery<T>, JpaQueryableCrite
|
|||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Accessors
|
||||
|
||||
/**
|
||||
* Return the {@linkplain #getRoots() roots} as a list.
|
||||
*/
|
||||
List<Root<?>> getRootList();
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
default List<Order> getOrderList() {
|
||||
|
|
|
@ -46,6 +46,8 @@ public interface JpaQueryStructure<T> extends JpaQueryPart<T> {
|
|||
|
||||
Set<? extends JpaRoot<?>> getRoots();
|
||||
|
||||
List<? extends JpaRoot<?>> getRootList();
|
||||
|
||||
JpaQueryStructure addRoot(JpaRoot<?> root);
|
||||
|
||||
|
||||
|
|
|
@ -211,6 +211,10 @@ public abstract class AbstractSqmSelectQuery<T>
|
|||
return (Set) getQuerySpec().getRoots();
|
||||
}
|
||||
|
||||
public List<Root<?>> getRootList() {
|
||||
return (List) getQuerySpec().getRootList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <X> SqmRoot<X> from(Class<X> entityClass) {
|
||||
return addRoot(
|
||||
|
|
|
@ -318,6 +318,12 @@ public class SqmQuerySpec<T> extends SqmQueryPart<T>
|
|||
return new HashSet<>( getFromClause().getRoots() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SqmRoot<?>> getRootList() {
|
||||
assert getFromClause() != null;
|
||||
return getFromClause().getRoots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SqmQuerySpec<T> addRoot(JpaRoot<?> root) {
|
||||
if ( getFromClause() == null ) {
|
||||
|
|
Loading…
Reference in New Issue