HHH-14475 Don't render subquery for collection functions
This commit is contained in:
parent
96980606fd
commit
12f1c7917e
|
@ -141,20 +141,25 @@ public class MethodNode extends AbstractSelectExpression implements FunctionNode
|
||||||
String propertyName = CollectionProperties.getNormalizedPropertyName( methodName );
|
String propertyName = CollectionProperties.getNormalizedPropertyName( methodName );
|
||||||
if ( expr instanceof FromReferenceNode ) {
|
if ( expr instanceof FromReferenceNode ) {
|
||||||
FromReferenceNode collectionNode = (FromReferenceNode) expr;
|
FromReferenceNode collectionNode = (FromReferenceNode) expr;
|
||||||
|
fromElement = collectionNode.getFromElement();
|
||||||
// If this is 'elements' then create a new FROM element.
|
// If this is 'elements' then create a new FROM element.
|
||||||
if ( CollectionPropertyNames.COLLECTION_ELEMENTS.equals( propertyName ) ) {
|
if ( CollectionPropertyNames.COLLECTION_ELEMENTS.equals( propertyName ) ) {
|
||||||
handleElements( collectionNode, propertyName );
|
QueryableCollection queryableCollection = fromElement.getQueryableCollection();
|
||||||
|
|
||||||
|
String path = collectionNode.getPath() + "[]." + propertyName;
|
||||||
|
LOG.debugf( "Creating elements for %s", path );
|
||||||
|
|
||||||
|
if ( !fromElement.isCollectionOfValuesOrComponents() ) {
|
||||||
|
getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() );
|
||||||
|
}
|
||||||
|
|
||||||
|
setDataType( queryableCollection.getElementType() );
|
||||||
|
selectColumns = fromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Not elements(x)
|
// Not elements(x)
|
||||||
fromElement = collectionNode.getFromElement();
|
setDataType( fromElement.getPropertyType( propertyName, propertyName ) );
|
||||||
|
selectColumns = fromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect );
|
||||||
final CollectionPropertyReference cpr = fromElement.getCollectionPropertyReference( propertyName );
|
|
||||||
setDataType( cpr.getType() );
|
|
||||||
selectColumns = cpr.toColumns( fromElement.getTableAlias() );
|
|
||||||
|
|
||||||
// setDataType( fromElement.getPropertyType( propertyName, propertyName ) );
|
|
||||||
// selectColumns = fromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( collectionNode instanceof DotNode ) {
|
if ( collectionNode instanceof DotNode ) {
|
||||||
|
@ -190,22 +195,6 @@ public class MethodNode extends AbstractSelectExpression implements FunctionNode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleElements(FromReferenceNode collectionNode, String propertyName) {
|
|
||||||
FromElement collectionFromElement = collectionNode.getFromElement();
|
|
||||||
QueryableCollection queryableCollection = collectionFromElement.getQueryableCollection();
|
|
||||||
|
|
||||||
String path = collectionNode.getPath() + "[]." + propertyName;
|
|
||||||
LOG.debugf( "Creating elements for %s", path );
|
|
||||||
|
|
||||||
fromElement = collectionFromElement;
|
|
||||||
if ( !collectionFromElement.isCollectionOfValuesOrComponents() ) {
|
|
||||||
getWalker().addQuerySpaces( queryableCollection.getElementPersister().getQuerySpaces() );
|
|
||||||
}
|
|
||||||
|
|
||||||
setDataType( queryableCollection.getElementType() );
|
|
||||||
selectColumns = collectionFromElement.toColumns( fromElement.getTableAlias(), propertyName, inSelect );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setScalarColumnText(int i) throws SemanticException {
|
public void setScalarColumnText(int i) throws SemanticException {
|
||||||
if ( selectColumns == null ) { // Dialect function
|
if ( selectColumns == null ) { // Dialect function
|
||||||
|
|
Loading…
Reference in New Issue