HHH-16815 Add default implementation throwing an exception for sorting methods on Query

This commit is contained in:
marko-bekhta 2023-06-19 09:17:52 +02:00 committed by Yoann Rodière
parent ada88805f8
commit a63eed837d
1 changed files with 18 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import jakarta.persistence.FlushModeType;
import jakarta.persistence.LockModeType; import jakarta.persistence.LockModeType;
import jakarta.persistence.Parameter; import jakarta.persistence.Parameter;
import jakarta.persistence.TemporalType; import jakarta.persistence.TemporalType;
import jakarta.persistence.metamodel.SingularAttribute;
import org.hibernate.CacheMode; import org.hibernate.CacheMode;
import org.hibernate.FlushMode; import org.hibernate.FlushMode;
@ -35,8 +36,10 @@ import org.hibernate.jpa.internal.util.FlushModeTypeHelper;
import org.hibernate.jpa.internal.util.LockModeTypeHelper; import org.hibernate.jpa.internal.util.LockModeTypeHelper;
import org.hibernate.query.BindableType; import org.hibernate.query.BindableType;
import org.hibernate.query.IllegalQueryOperationException; import org.hibernate.query.IllegalQueryOperationException;
import org.hibernate.query.Query;
import org.hibernate.query.QueryParameter; import org.hibernate.query.QueryParameter;
import org.hibernate.query.ResultListTransformer; import org.hibernate.query.ResultListTransformer;
import org.hibernate.query.SelectionQuery;
import org.hibernate.query.TupleTransformer; import org.hibernate.query.TupleTransformer;
import org.hibernate.query.named.NamedQueryMemento; import org.hibernate.query.named.NamedQueryMemento;
@ -275,6 +278,21 @@ public abstract class AbstractQuery<R>
return this; return this;
} }
@Override
public Query<R> ascending(SingularAttribute<? super R, ?> attribute) {
throw new UnsupportedOperationException( "Should be implemented by " + this.getClass().getName() );
}
@Override
public Query<R> descending(SingularAttribute<? super R, ?> attribute) {
throw new UnsupportedOperationException( "Should be implemented by " + this.getClass().getName() );
}
@Override
public Query<R> unordered() {
throw new UnsupportedOperationException( "Should be implemented by " + this.getClass().getName() );
}
@Override @Override
public String getComment() { public String getComment() {
return super.getComment(); return super.getComment();