mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 00:24:57 +00:00
HHH-4881: Keep track of the owning expression so we can get the path identifier
This commit is contained in:
parent
1b30c4a9f2
commit
972aa060a6
@ -26,6 +26,7 @@
|
||||
import org.hibernate.ejb.criteria.CriteriaBuilderImpl;
|
||||
import org.hibernate.ejb.criteria.CriteriaQueryCompiler;
|
||||
import org.hibernate.ejb.criteria.ParameterRegistry;
|
||||
import org.hibernate.ejb.criteria.path.AbstractPathImpl;
|
||||
|
||||
/**
|
||||
* Used to construct the result of {@link javax.persistence.criteria.Path#type()}
|
||||
@ -33,8 +34,11 @@
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class PathTypeExpression<T> extends ExpressionImpl<T> implements Serializable {
|
||||
public PathTypeExpression(CriteriaBuilderImpl criteriaBuilder, Class<T> javaType) {
|
||||
private final AbstractPathImpl<T> pathImpl;
|
||||
|
||||
public PathTypeExpression(CriteriaBuilderImpl criteriaBuilder, Class<T> javaType, AbstractPathImpl<T> pathImpl) {
|
||||
super( criteriaBuilder, javaType );
|
||||
this.pathImpl = pathImpl;
|
||||
}
|
||||
|
||||
public void registerParameters(ParameterRegistry registry) {
|
||||
@ -42,8 +46,7 @@ public void registerParameters(ParameterRegistry registry) {
|
||||
}
|
||||
|
||||
public String render(CriteriaQueryCompiler.RenderingContext renderingContext) {
|
||||
// todo : is it valid for this to get rendered into the query itself?
|
||||
throw new IllegalArgumentException( "Unexpected call on EntityTypeExpression#render" );
|
||||
return "type(" + pathImpl.getPathIdentifier() + ")";
|
||||
}
|
||||
|
||||
public String renderProjection(CriteriaQueryCompiler.RenderingContext renderingContext) {
|
||||
|
@ -67,7 +67,7 @@ public AbstractPathImpl(
|
||||
PathSource pathSource) {
|
||||
super( criteriaBuilder, javaType );
|
||||
this.pathSource = pathSource;
|
||||
this.typeExpression = new PathTypeExpression( criteriaBuilder(), getJavaType() );
|
||||
this.typeExpression = new PathTypeExpression( criteriaBuilder(), getJavaType(), this );
|
||||
}
|
||||
|
||||
public PathSource getPathSource() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user