java.lang.NullPointerException

Hibernate JIRA | Mihail Fridliand | 9 years ago
  1. 0

    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>

    Hibernate JIRA | 9 years ago | Mihail Fridliand
    java.lang.NullPointerException
  2. 0

    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>

    Hibernate JIRA | 9 years ago | Mihail Fridliand
    java.lang.NullPointerException
  3. 0

    how to execute Oracle "CONNECT BY" using JPA or Hibernate annotation?

    Oracle Community | 7 years ago | 843830
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties()
    2. Hibernate
      SQLCustomQuery.<init>
      1. org.hibernate.loader.custom.sql.SQLQueryParser.resolveProperties(SQLQueryParser.java:182)
      2. org.hibernate.loader.custom.sql.SQLQueryParser.resolveCollectionProperties(SQLQueryParser.java:135)
      3. org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:98)
      4. org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51)
      5. org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110)
      5 frames
    3. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43)
      2. org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114)
      3. org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:444)
      4. org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:351)
      4 frames
    4. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1291)
      1 frame