glassfish
  1. glassfish
  2. GLASSFISH-3574

NullPointerException in appendFromClauseForInformixOuterJoin

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Blocker Blocker
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: All

    • Issuezilla Id:
      3,574

      Description

      Sun Java System Application Server 9.1 (build b58-rc1)
      Database is Informix 10 (This Exception does not appear with DERBY)
      NetBeans 5.5.1

      Mapping:
      --------------------------------------------------------------------------------
      @Entity
      @Inheritance(strategy=InheritanceType.JOINED)
      public class Parent implements Serializable {

      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long parentId;
      ......
      @Entity
      @PrimaryKeyJoinColumn(name="CHILDID")
      public class Child extends Parent implements Serializable {
      --------------------------------------------------------------------------------

      Statement:

      Collection<Parent> cP = em.createQuery("select o from Parent o ).getResultList();

      Exception in thread "main" java.lang.NullPointerException
      at
      oracle.toplink.essentials.internal.expressions.SQLSelectStatement.appendFromClauseForInformixOuterJoin(SQLSelectStatement.java:178)
      at
      oracle.toplink.essentials.internal.expressions.SQLSelectStatement.appendFromClauseToWriter(SQLSelectStatement.java:450)
      at
      oracle.toplink.essentials.internal.expressions.SQLSelectStatement.printSQL(SQLSelectStatement.java:1310)
      at
      oracle.toplink.essentials.internal.expressions.SQLSelectStatement.buildCall(SQLSelectStatement.java:683)
      at
      oracle.toplink.essentials.descriptors.ClassDescriptor.buildCallFromStatement(ClassDescriptor.java:550)
      at
      oracle.toplink.essentials.internal.queryframework.StatementQueryMechanism.setCallFromStatement(StatementQueryMechanism.java:393)
      at
      oracle.toplink.essentials.internal.queryframework.ExpressionQueryMechanism.prepareReportQuerySelectAllRows(ExpressionQueryMechanism.java:1321)
      at
      oracle.toplink.essentials.queryframework.ReportQuery.prepareSelectAllRows(ReportQuery.java:988)
      at
      oracle.toplink.essentials.queryframework.ReadAllQuery.prepare(ReadAllQuery.java:398)
      at
      oracle.toplink.essentials.queryframework.ReportQuery.prepare(ReportQuery.java:904)
      at
      oracle.toplink.essentials.queryframework.DatabaseQuery.checkPrepare(DatabaseQuery.java:387)
      at
      oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.checkPrepare(ObjectLevelReadQuery.java:469)
      at
      oracle.toplink.essentials.queryframework.DatabaseQuery.execute(DatabaseQuery.java:587)
      at
      oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:677)
      at
      oracle.toplink.essentials.queryframework.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:731)
      at
      oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2218)
      at
      oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:937)
      at
      oracle.toplink.essentials.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:909)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:346)
      at
      oracle.toplink.essentials.internal.ejb.cmp3.base.EJBQueryImpl.getResultList(EJBQueryImpl.java:447)
      at javaapplication4.Main.main(Main.java:56)

        Activity

        Hide
        gfbugbridge added a comment -

        <BT6600180>

        Show
        gfbugbridge added a comment - <BT6600180>
        Hide
        tware added a comment -

        The following line does not look like it would even compile - it is missing a
        quote...

        Collection<Parent> cP = em.createQuery("select o from Parent o ).getResultList();

        Is this the full query? I am surprised you are getting into that area of the
        code without an outer join in the query.

        Show
        tware added a comment - The following line does not look like it would even compile - it is missing a quote... Collection<Parent> cP = em.createQuery("select o from Parent o ).getResultList(); Is this the full query? I am surprised you are getting into that area of the code without an outer join in the query.
        Hide
        tware added a comment -

        I think I now see why you are getting an outer join.

        It's because of the inheritance.

        Sorry for any confusion.

        Show
        tware added a comment - I think I now see why you are getting an outer join. It's because of the inheritance. Sorry for any confusion.
        Hide
        tware added a comment -

        Switching to Enhancement

        Informix requires special outer join support and it appears that some of the
        code written to support outer joins on Informix when using joins inheritance is
        broken.

        TopLink Essentials is certified against a set of databases that is similar to
        the non-open-source TopLink version. As you can see from the following web page,
        Informix is not a certified platform.

        http://www.oracle.com/technology/products/ias/toplink/technical/support/database1013.html

        What this means is that while we will endeavor to help users of this database
        get the functionality they are looking for, the amount of testing that has been
        done against this database is much lower than the certified databases.

        We would be happy to provide a resource to help the interested members of the
        community get this support working better.

        Show
        tware added a comment - Switching to Enhancement Informix requires special outer join support and it appears that some of the code written to support outer joins on Informix when using joins inheritance is broken. TopLink Essentials is certified against a set of databases that is similar to the non-open-source TopLink version. As you can see from the following web page, Informix is not a certified platform. http://www.oracle.com/technology/products/ias/toplink/technical/support/database1013.html What this means is that while we will endeavor to help users of this database get the functionality they are looking for, the amount of testing that has been done against this database is much lower than the certified databases. We would be happy to provide a resource to help the interested members of the community get this support working better.
        Hide
        bernd_zedv added a comment -

        Since a couple of years Informix supports ANSI JOINS. Hibernate's Informix
        adapter works this way and does this job fine.

        There is that ... boolean isInformixOuterJoin() ... in Toplink code and my hope
        was to find a workaround which e.g. influences Toplink to generate the ususal
        SQL (ANSI) code even for Informix.

        For some other reasons I cannot/want not switch to Hibernate persistence manager.

        Show
        bernd_zedv added a comment - Since a couple of years Informix supports ANSI JOINS. Hibernate's Informix adapter works this way and does this job fine. There is that ... boolean isInformixOuterJoin() ... in Toplink code and my hope was to find a workaround which e.g. influences Toplink to generate the ususal SQL (ANSI) code even for Informix. For some other reasons I cannot/want not switch to Hibernate persistence manager.
        Hide
        tware added a comment -

        You could try subclassing the InformixPlatform. There are two methods that
        affect how outer joins are written.

        isInformixOuterJoin()
        shouldPrintOuterJoinInWhereClause()

        Overriding isInformixOuterJoin() to return false
        and/or overriding shouldPrintOuterJoinInWhereClause() to return true

        could help you generate the syntax you want.

        When you have your new platform, you can use the toplink.target-database
        persistence property and set its value to your fully qualified class name.

        Show
        tware added a comment - You could try subclassing the InformixPlatform. There are two methods that affect how outer joins are written. isInformixOuterJoin() shouldPrintOuterJoinInWhereClause() Overriding isInformixOuterJoin() to return false and/or overriding shouldPrintOuterJoinInWhereClause() to return true could help you generate the syntax you want. When you have your new platform, you can use the toplink.target-database persistence property and set its value to your fully qualified class name.
        Hide
        bernd_zedv added a comment -

        After I changed
        oracle.toplink.essentials.platform.database.InformixPlatform.isInformixOuterJoin()
        to return false, ANSI SQL outer syntax is generated and no more
        NullPointerExceptions arise.

        Changing shouldPrintOuterJoinInWhereClause() does not work - it merely generates
        weird " =* " in WHERE clause.

        Thanks!
        Bernd

        Show
        bernd_zedv added a comment - After I changed oracle.toplink.essentials.platform.database.InformixPlatform.isInformixOuterJoin() to return false, ANSI SQL outer syntax is generated and no more NullPointerExceptions arise. Changing shouldPrintOuterJoinInWhereClause() does not work - it merely generates weird " =* " in WHERE clause. Thanks! Bernd
        Hide
        Tom Mueller added a comment -

        Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

        Show
        Tom Mueller added a comment - Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

          People

          • Assignee:
            tware
            Reporter:
            bernd_zedv
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: