java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • NullPointerException when joining many-to-many assoziation with native SQL query: java.lang.NullPointerException at org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties(SQLQueryParser.java:182) at org.hibernate.loader.custom.sql.SQLQueryParser.resolveCollectionProperties(SQLQueryParser.java:135) at org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:98) at org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51) at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110) at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43) at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:444) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:351) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291) The SQLQueryReturnProcessor ignores many-to-many assoziations: private void addCollection(String role, String alias, Map propertyResults) { SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role ); alias2CollectionPersister.put( alias, collectionPersister ); String suffix = generateCollectionSuffix(); log.trace( "mapping alias [" + alias + "] to collection-suffix [" + suffix + "]" ); alias2CollectionSuffix.put( alias, suffix ); collectionPropertyResultMaps.put( alias, propertyResults ); if ( collectionPersister.isOneToMany() ) { SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister(); addPersister( alias, filter( propertyResults ), persister ); } } Mapping of a many-to-many: <hibernate-mapping> <class name="A" table="A" schema="TEST" > <set name="manyToMany" inverse="true" table="AC" > <key> <column name="A_OID" not-null="true" /> </key> <many-to-many class="C"> <column name="C_OID" not-null="true" /> </many-to-many> </set> </class> <class name="C" table="C" schema="TEST"> </class> <resultset name="AandC"> <return alias="a" class="A"/> <return-join alias="c" property="a.manyToMany"/> </resultset> <sql-query name="getAandC" resultset-ref="AandC" > <![CDATA[ select DISTINCT {a.*},{c.*} from A a join AC ac on a.OID = ac.A_OID join C c on c.C_OID=ac.C_OID ]]> </sql-query> </hibernate-mapping>
    via by Mihail Fridliand,
  • NullPointerException when joining many-to-many assoziation with native SQL query: java.lang.NullPointerException at org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties(SQLQueryParser.java:182) at org.hibernate.loader.custom.sql.SQLQueryParser.resolveCollectionProperties(SQLQueryParser.java:135) at org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:98) at org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51) at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110) at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43) at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:444) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:351) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291) The SQLQueryReturnProcessor ignores many-to-many assoziations: private void addCollection(String role, String alias, Map propertyResults) { SQLLoadableCollection collectionPersister = ( SQLLoadableCollection ) factory.getCollectionPersister( role ); alias2CollectionPersister.put( alias, collectionPersister ); String suffix = generateCollectionSuffix(); log.trace( "mapping alias [" + alias + "] to collection-suffix [" + suffix + "]" ); alias2CollectionSuffix.put( alias, suffix ); collectionPropertyResultMaps.put( alias, propertyResults ); if ( collectionPersister.isOneToMany() ) { SQLLoadable persister = ( SQLLoadable ) collectionPersister.getElementPersister(); addPersister( alias, filter( propertyResults ), persister ); } } Mapping of a many-to-many: <hibernate-mapping> <class name="A" table="A" schema="TEST" > <set name="manyToMany" inverse="true" table="AC" > <key> <column name="A_OID" not-null="true" /> </key> <many-to-many class="C"> <column name="C_OID" not-null="true" /> </many-to-many> </set> </class> <class name="C" table="C" schema="TEST"> </class> <resultset name="AandC"> <return alias="a" class="A"/> <return-join alias="c" property="a.manyToMany"/> </resultset> <sql-query name="getAandC" resultset-ref="AandC" > <![CDATA[ select DISTINCT {a.*},{c.*} from A a join AC ac on a.OID = ac.A_OID join C c on c.C_OID=ac.C_OID ]]> </sql-query> </hibernate-mapping>
    via by Mihail Fridliand,
    • java.lang.NullPointerException at org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties(SQLQueryParser.java:182) at org.hibernate.loader.custom.sql.SQLQueryParser.resolveCollectionProperties(SQLQueryParser.java:135) at org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:98) at org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51) at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110) at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43) at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:444) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:351) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
    No Bugmate found.