HHH-11081 - JPA join with treat causes QuerySyntaxException: Invalid path

(cherry picked from commit c9c50d8afd)

Conflicts:
	hibernate-entitymanager/src/main/java/org/hibernate/jpa/criteria/FromImplementor.java

(cherry picked from commit e2eb7128c3)
This commit is contained in:
Andrea Boriero 2016-09-12 23:57:48 +01:00 committed by Gail Badner
parent 5bb5931f38
commit 14d897fe96
7 changed files with 5 additions and 59 deletions

View File

@ -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();
}

View File

@ -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() );
}
}

View File

@ -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() + ")";

View File

@ -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() + ")";

View File

@ -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() + ")";

View File

@ -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() + ")";

View File

@ -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() + ")";