title: NullpointerException with hql query in Hibernate NameGenerator
body: <p>i have an issue with hql queries which contain a null in the select, for example:
  "select firstname, lastname, null from Employer"</p>
  
  <p>The Nullpointer comes from:</p>
  
  <pre><code>Caused by: java.lang.NullPointerException
  at org.hibernate.hql.internal.NameGenerator.generateColumnNames(NameGenerator.java:27)
  </code></pre>
  
  <p>So the code in NameGenerator at that line:</p>
  
  <pre><code>public static String[][] generateColumnNames(Type[] types, SessionFactoryImplementor f) throws MappingException {
      String[][] columnNames = new String[types.length][];
      for ( int i = 0; i &lt; types.length; i++ ) {
          int span = types[i].getColumnSpan( f );  // &lt;-- line 27
          columnNames[i] = new String[span];
          for ( int j = 0; j &lt; span; j++ ) {
              columnNames[i][j] = NameGenerator.scalarName( i, j );
          }
      }
      return columnNames;
  }
  </code></pre>
  
  <p>I narrowed it down to the new Class <a href="https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/NullNode.java" rel="nofollow noreferrer">NullNode</a> (added since Hibernate 5), which simply returns null for getType():</p>
  
  <pre><code>public class NullNode extends AbstractSelectExpression {
  
     public Type getDataType() {
         return null;
     } 
   ....
  }
  </code></pre>
  
  <p>So my question is.. is this a bug in hibernate or am i missusing hibernate at that place?</p>