HHH-11081 - JPA join with treat causes QuerySyntaxException: Invalid path
(cherry picked from commitc9c50d8afd
) Conflicts: hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/FromImplementor.java (cherry picked from commite2eb7128c3
)
This commit is contained in:
parent
5bb5931f38
commit
14d897fe96
|
@ -22,6 +22,4 @@ public interface FromImplementor<Z,X> extends PathImplementor<X>, From<Z,X> {
|
|||
FromImplementor<Z,X> correlateTo(CriteriaSubqueryImpl subquery);
|
||||
void prepareCorrelationDelegate(FromImplementor<Z,X> parent);
|
||||
FromImplementor<Z, X> getCorrelationParent();
|
||||
|
||||
boolean shouldBeRendered();
|
||||
}
|
||||
|
|
|
@ -336,13 +336,11 @@ public class QueryStructure<T> implements Serializable {
|
|||
}
|
||||
|
||||
for ( Join join : joins ) {
|
||||
if ( ((FromImplementor) join).shouldBeRendered() ) {
|
||||
((FromImplementor) join).prepareAlias( renderingContext );
|
||||
jpaqlQuery.append( renderJoinType( join.getJoinType() ) )
|
||||
.append( ((FromImplementor) join).renderTableExpression( renderingContext ) );
|
||||
renderJoins( jpaqlQuery, renderingContext, join.getJoins() );
|
||||
renderFetches( jpaqlQuery, renderingContext, join.getFetches() );
|
||||
}
|
||||
( (FromImplementor) join ).prepareAlias( renderingContext );
|
||||
jpaqlQuery.append( renderJoinType( join.getJoinType() ) )
|
||||
.append( ( (FromImplementor) join ).renderTableExpression( renderingContext ) );
|
||||
renderJoins( jpaqlQuery, renderingContext, join.getJoins() );
|
||||
renderFetches( jpaqlQuery, renderingContext, join.getFetches() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,16 +119,6 @@ public class CollectionAttributeJoin<O,E>
|
|||
original.setAlias( alias );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeRendered() {
|
||||
if ( getJoins().size() > 0 ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(RenderingContext renderingContext) {
|
||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||
|
|
|
@ -127,16 +127,6 @@ public class ListAttributeJoin<O,E>
|
|||
original.setAlias( alias );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeRendered() {
|
||||
if ( getJoins().size() > 0 ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(RenderingContext renderingContext) {
|
||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||
|
|
|
@ -148,16 +148,6 @@ public class MapAttributeJoin<O,K,V>
|
|||
original.setAlias( alias );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeRendered() {
|
||||
if ( getJoins().size() > 0 ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(RenderingContext renderingContext) {
|
||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||
|
|
|
@ -124,16 +124,6 @@ public class SetAttributeJoin<O,E>
|
|||
original.setAlias( alias );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeRendered() {
|
||||
if ( getJoins().size() > 0 ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(RenderingContext renderingContext) {
|
||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||
|
|
|
@ -159,16 +159,6 @@ public class SingularAttributeJoin<O,X> extends AbstractJoinImpl<O,X> {
|
|||
return criteriaBuilder().getEntityManagerFactory().getMetamodel().managedType( treatAsType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldBeRendered() {
|
||||
if ( getJoins().size() > 0 ) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String render(RenderingContext renderingContext) {
|
||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||
|
|
Loading…
Reference in New Issue