小编Joh*_*kov的帖子

Hibernate NameGenerator 中 hql 查询出现 NullpointerException

我在选择中包含 null 的 hql 查询时遇到问题,例如:“从雇主中选择名字、姓氏、null”

空指针来自:

Caused by: java.lang.NullPointerException
at org.hibernate.hql.internal.NameGenerator.generateColumnNames(NameGenerator.java:27)
Run Code Online (Sandbox Code Playgroud)

所以 NameGenerator 中该行的代码:

public static String[][] generateColumnNames(Type[] types, SessionFactoryImplementor f) throws MappingException {
    String[][] columnNames = new String[types.length][];
    for ( int i = 0; i < types.length; i++ ) {
        int span = types[i].getColumnSpan( f );  // <-- line 27
        columnNames[i] = new String[span];
        for ( int j = 0; j < span; j++ ) {
            columnNames[i][j] = NameGenerator.scalarName( i, j );
        }
    }
    return columnNames;
}
Run Code Online (Sandbox Code Playgroud)

我将其范围缩小到新的NullNode …

java orm nullpointerexception hibernate-5.x

6
推荐指数
1
解决办法
3332
查看次数

标签 统计

hibernate-5.x ×1

java ×1

nullpointerexception ×1

orm ×1