//sqlResultTypeList.addAll( constructorArgumentTypeList );
queryReturnTypeList.addAll( constructorArgumentTypeList );
scalarSelect = true;
}
else {
Type type = expr.getDataType();
if ( type == null ) {
throw new IllegalStateException( "No data type for node: " + expr.getClass().getName() + " "
+ new ASTPrinter( SqlTokenTypes.class ).showAsString( ( AST ) expr, "" ) );
}
//sqlResultTypeList.add( type );
// If the data type is not an association type, it could not have been in the FROM clause.
if ( expr.isScalar() ) {
scalarSelect = true;
}
if ( isReturnableEntity( expr ) ) {
fromElementsForLoad.add( expr.getFromElement() );
}
// Always add the type to the return type list.
queryReturnTypeList.add( type );
}
}
//init the aliases, after initing the constructornode
initAliases(selectExpressions);
if ( !getWalker().isShallowQuery() ) {
// add the fetched entities
List fromElements = fromClause.getProjectionList();
ASTAppender appender = new ASTAppender( getASTFactory(), this ); // Get ready to start adding nodes.
int size = fromElements.size();
Iterator iterator = fromElements.iterator();
for ( int k = 0; iterator.hasNext(); k++ ) {
FromElement fromElement = ( FromElement ) iterator.next();
if ( fromElement.isFetch() ) {
FromElement origin = null;
if ( fromElement.getRealOrigin() == null ) {
// work around that crazy issue where the tree contains
// "empty" FromElements (no text); afaict, this is caused
// by FromElementFactory.createCollectionJoin()
if ( fromElement.getOrigin() == null ) {
throw new QueryException( "Unable to determine origin of join fetch [" + fromElement.getDisplayText() + "]" );
}
else {
origin = fromElement.getOrigin();
}
}
else {
origin = fromElement.getRealOrigin();
}
if ( !fromElementsForLoad.contains( origin ) ) {
throw new QueryException(
"query specified join fetching, but the owner " +
"of the fetched association was not present in the select list " +
"[" + fromElement.getDisplayText() + "]"
);
}
Type type = fromElement.getSelectType();
addCollectionFromElement( fromElement );
if ( type != null ) {
boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
if ( !collectionOfElements ) {
// Add the type to the list of returned sqlResultTypes.