HHH-11081 - JPA join with treat causes QuerySyntaxException: Invalid path
This commit is contained in:
parent
4d3ece8c09
commit
c9c50d8afd
|
@ -22,8 +22,4 @@ public interface FromImplementor<Z,X> extends PathImplementor<X>, From<Z,X> {
|
||||||
FromImplementor<Z,X> correlateTo(CriteriaSubqueryImpl subquery);
|
FromImplementor<Z,X> correlateTo(CriteriaSubqueryImpl subquery);
|
||||||
void prepareCorrelationDelegate(FromImplementor<Z,X> parent);
|
void prepareCorrelationDelegate(FromImplementor<Z,X> parent);
|
||||||
FromImplementor<Z, X> getCorrelationParent();
|
FromImplementor<Z, X> getCorrelationParent();
|
||||||
|
|
||||||
default boolean shouldBeRendered(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,13 +336,11 @@ public class QueryStructure<T> implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Join join : joins ) {
|
for ( Join join : joins ) {
|
||||||
if ( ((FromImplementor) join).shouldBeRendered() ) {
|
( (FromImplementor) join ).prepareAlias( renderingContext );
|
||||||
((FromImplementor) join).prepareAlias( renderingContext );
|
jpaqlQuery.append( renderJoinType( join.getJoinType() ) )
|
||||||
jpaqlQuery.append( renderJoinType( join.getJoinType() ) )
|
.append( ( (FromImplementor) join ).renderTableExpression( renderingContext ) );
|
||||||
.append( ((FromImplementor) join).renderTableExpression( renderingContext ) );
|
renderJoins( jpaqlQuery, renderingContext, join.getJoins() );
|
||||||
renderJoins( jpaqlQuery, renderingContext, join.getJoins() );
|
renderFetches( jpaqlQuery, renderingContext, join.getFetches() );
|
||||||
renderFetches( jpaqlQuery, renderingContext, join.getFetches() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,16 +119,6 @@ public class CollectionAttributeJoin<O,E>
|
||||||
original.setAlias( alias );
|
original.setAlias( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeRendered() {
|
|
||||||
if ( getJoins().size() > 0 ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||||
|
|
|
@ -127,16 +127,6 @@ public class ListAttributeJoin<O,E>
|
||||||
original.setAlias( alias );
|
original.setAlias( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeRendered() {
|
|
||||||
if ( getJoins().size() > 0 ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||||
|
|
|
@ -148,16 +148,6 @@ public class MapAttributeJoin<O,K,V>
|
||||||
original.setAlias( alias );
|
original.setAlias( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeRendered() {
|
|
||||||
if ( getJoins().size() > 0 ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||||
|
|
|
@ -124,16 +124,6 @@ public class SetAttributeJoin<O,E>
|
||||||
original.setAlias( alias );
|
original.setAlias( alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeRendered() {
|
|
||||||
if ( getJoins().size() > 0 ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
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 );
|
return criteriaBuilder().getEntityManagerFactory().getMetamodel().managedType( treatAsType );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldBeRendered() {
|
|
||||||
if ( getJoins().size() > 0 ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
return "treat(" + original.render( renderingContext ) + " as " + treatAsType.getName() + ")";
|
||||||
|
|
Loading…
Reference in New Issue