Fix SmqBagJoin, SqmSetJoin and SqmListJoin throwing NotYetImplementedFor6Exception

This commit is contained in:
Andrea Boriero 2021-05-20 09:26:32 +02:00 committed by Andrea Boriero
parent cbeedd1c32
commit 629b318731
4 changed files with 5 additions and 103 deletions

View File

@ -11,6 +11,7 @@ import java.util.Set;
import org.hibernate.metamodel.internal.MetadataContext; import org.hibernate.metamodel.internal.MetadataContext;
import org.hibernate.metamodel.model.domain.SetPersistentAttribute; import org.hibernate.metamodel.model.domain.SetPersistentAttribute;
import org.hibernate.query.hql.spi.SqmCreationState; import org.hibernate.query.hql.spi.SqmCreationState;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.SqmJoinType;
import org.hibernate.query.sqm.tree.domain.SqmSetJoin; import org.hibernate.query.sqm.tree.domain.SqmSetJoin;
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;

View File

@ -8,20 +8,16 @@ package org.hibernate.query.sqm.tree.domain;
import java.util.Collection; import java.util.Collection;
import javax.persistence.criteria.Expression; import javax.persistence.criteria.Expression;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.metamodel.PluralAttribute;
import javax.persistence.metamodel.SingularAttribute;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.model.domain.BagPersistentAttribute; import org.hibernate.metamodel.model.domain.BagPersistentAttribute;
import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.query.PathException; import org.hibernate.query.PathException;
import org.hibernate.query.criteria.JpaCollectionJoin; import org.hibernate.query.criteria.JpaCollectionJoin;
import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaExpression;
import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.criteria.JpaPredicate;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.hql.spi.SqmCreationProcessingState; import org.hibernate.query.hql.spi.SqmCreationProcessingState;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.SqmJoinType;
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
import org.hibernate.query.sqm.tree.from.SqmFrom; import org.hibernate.query.sqm.tree.from.SqmFrom;
@ -43,8 +39,7 @@ public class SqmBagJoin<O, E> extends AbstractSqmPluralJoin<O,Collection<E>, E>
@Override @Override
public BagPersistentAttribute<O,E> getReferencedPathSource() { public BagPersistentAttribute<O,E> getReferencedPathSource() {
//noinspection unchecked return (BagPersistentAttribute<O,E>) super.getReferencedPathSource();
return (BagPersistentAttribute) super.getReferencedPathSource();
} }
@Override @Override
@ -85,36 +80,6 @@ public class SqmBagJoin<O, E> extends AbstractSqmPluralJoin<O,Collection<E>, E>
// todo (6.0) : need to resolve these fetches against the element/index descriptors // todo (6.0) : need to resolve these fetches against the element/index descriptors
@Override
public <A> SqmSingularJoin<E, A> fetch(SingularAttribute<? super E, A> attribute) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <A> SqmSingularJoin<E,A> fetch(SingularAttribute<? super E, A> attribute, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <F> SqmAttributeJoin<E,F> fetch(PluralAttribute<? super E, ?, F> attribute) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <F> SqmAttributeJoin<E,F> fetch(PluralAttribute<? super E, ?, F> attribute, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <X,Y> SqmAttributeJoin<X,Y> fetch(String attributeName) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <X,Y> SqmAttributeJoin<X,Y> fetch(String attributeName, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override @Override
public SqmCorrelatedBagJoin<O, E> createCorrelation() { public SqmCorrelatedBagJoin<O, E> createCorrelation() {
return new SqmCorrelatedBagJoin<>( this ); return new SqmCorrelatedBagJoin<>( this );

View File

@ -8,12 +8,8 @@ package org.hibernate.query.sqm.tree.domain;
import java.util.List; import java.util.List;
import javax.persistence.criteria.Expression; import javax.persistence.criteria.Expression;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.metamodel.PluralAttribute;
import javax.persistence.metamodel.SingularAttribute;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.metamodel.model.domain.ListPersistentAttribute; import org.hibernate.metamodel.model.domain.ListPersistentAttribute;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
@ -21,8 +17,8 @@ import org.hibernate.query.PathException;
import org.hibernate.query.criteria.JpaExpression; import org.hibernate.query.criteria.JpaExpression;
import org.hibernate.query.criteria.JpaListJoin; import org.hibernate.query.criteria.JpaListJoin;
import org.hibernate.query.criteria.JpaPredicate; import org.hibernate.query.criteria.JpaPredicate;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.hql.spi.SqmCreationProcessingState; import org.hibernate.query.hql.spi.SqmCreationProcessingState;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.sqm.tree.SqmJoinType; import org.hibernate.query.sqm.tree.SqmJoinType;
import org.hibernate.query.sqm.tree.from.SqmAttributeJoin; import org.hibernate.query.sqm.tree.from.SqmAttributeJoin;
import org.hibernate.query.sqm.tree.from.SqmFrom; import org.hibernate.query.sqm.tree.from.SqmFrom;
@ -116,36 +112,6 @@ public class SqmListJoin<O,E>
return new SqmTreatedListJoin( this, treatTarget, null ); return new SqmTreatedListJoin( this, treatTarget, null );
} }
@Override
public <A> SqmSingularJoin<E, A> fetch(SingularAttribute<? super E, A> attribute) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <A> SqmSingularJoin<E,A> fetch(SingularAttribute<? super E, A> attribute, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <F> SqmAttributeJoin<E,F> fetch(PluralAttribute<? super E, ?, F> attribute) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <F> SqmAttributeJoin<E,F> fetch(PluralAttribute<? super E, ?, F> attribute, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <X,Y> SqmAttributeJoin<X,Y> fetch(String attributeName) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <X,Y> SqmAttributeJoin<X,Y> fetch(String attributeName, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override @Override
public SqmAttributeJoin makeCopy(SqmCreationProcessingState creationProcessingState) { public SqmAttributeJoin makeCopy(SqmCreationProcessingState creationProcessingState) {
//noinspection unchecked //noinspection unchecked

View File

@ -10,10 +10,7 @@ import java.util.Set;
import javax.persistence.criteria.Expression; import javax.persistence.criteria.Expression;
import javax.persistence.criteria.JoinType; import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.metamodel.PluralAttribute;
import javax.persistence.metamodel.SingularAttribute;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.metamodel.model.domain.SetPersistentAttribute; import org.hibernate.metamodel.model.domain.SetPersistentAttribute;
import org.hibernate.query.PathException; import org.hibernate.query.PathException;
@ -99,36 +96,9 @@ public class SqmSetJoin<O, E>
return new SqmTreatedSetJoin<>( this, treatTarget, null ); return new SqmTreatedSetJoin<>( this, treatTarget, null );
} }
// todo (6.0) : need to resolve these fetches against the element/index descriptors
@Override
public <A> SqmSingularJoin<E, A> fetch(SingularAttribute<? super E, A> attribute) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <A> SqmSingularJoin<E, A> fetch(SingularAttribute<? super E, A> attribute, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <F> SqmAttributeJoin<E, F> fetch(PluralAttribute<? super E, ?, F> attribute) {
throw new NotYetImplementedFor6Exception();
}
@Override
public <F> SqmAttributeJoin<E, F> fetch(PluralAttribute<? super E, ?, F> attribute, JoinType jt) {
throw new NotYetImplementedFor6Exception();
}
@Override @Override
public <X, Y> SqmAttributeJoin<X, Y> fetch(String attributeName) { public <X, Y> SqmAttributeJoin<X, Y> fetch(String attributeName) {
throw new NotYetImplementedFor6Exception(); return fetch( attributeName, JoinType.INNER);
}
@Override
public <X, Y> SqmAttributeJoin<X, Y> fetch(String attributeName, JoinType jt) {
throw new NotYetImplementedFor6Exception();
} }
@Override @Override