[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2917) arithmatic of subselect throws NPE

John Aylward (JIRA) noreply at atlassian.com
Sun Oct 28 17:04:38 EDT 2007


arithmatic of subselect throws NPE
----------------------------------

                 Key: HHH-2917
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2917
             Project: Hibernate3
          Issue Type: Bug
          Components: query-hql
    Affects Versions: 3.2.5
         Environment: Hibernate 3.2.5
Annotation 3.3.0
VAlidator 3.0.0
MySQL 5.0.44
            Reporter: John Aylward


Exception Stack:

java.lang.NullPointerException
        at org.hibernate.hql.ast.tree.BinaryArithmeticOperatorNode.getRightHandOperand(BinaryArithmeticOperatorNode.java:185)
        at org.hibernate.hql.ast.tree.BinaryArithmeticOperatorNode.initialize(BinaryArithmeticOperatorNode.java:20)
        at org.hibernate.hql.ast.HqlSqlWalker.prepareArithmeticOperator(HqlSqlWalker.java:1011)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.arithmeticExpr(HqlSqlBaseWalker.java:2729)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1278)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3600)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1690)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
        at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
        at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
        at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
        at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
        at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
        at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
        at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
        at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
        at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)


HQL:
[SELECT DISTINCT pi.billingAccount.consolidatedBillingAccount.bankAccount FROM com.cicat.bedrock.billing.model.ProviderInvoice AS pi WHERE pi.readyForPayment=true AND (SELECT piad.total FROM com.cicat.bedrock.billing.model.ProviderInvoiceAccountData AS piad WHERE piad.invoice = pi AND piad.providerBillingAccount = pi.billingAccount) > ((SELECT COALESCE(SUM(amount),0) FROM com.cicat.bedrock.billing.model.BankAccountTransaction AS bat1 WHERE bat1.deleted=false AND bat1.providerInvoice = pi) + (SELECT COALESCE(SUM(amount),0) FROM com.cicat.bedrock.billing.model.BankAccountTransactionSplit AS bats1 WHERE bats1.deleted=false AND bats1.bankAccountTransaction.deleted=false AND bats1.providerInvoice = pi)) ]

Representative SQL of HQL call:
SELECT DISTINCT ba.* from ProviderInvoice AS pi
  INNER JOIN ProviderBillingAccount AS pba ON pi.billingAccount_id=pba.id
  INNER JOIN ConsolidatedBillingAccount AS cba ON pba.consolidatedBillingAccount_id=cba.id
  INNER JOIN BankAccount AS ba ON cba.bankAccount_id=ba.id
WHERE
  pi.readyForPayment=true AND
 (SELECT piad.total FROM ProviderInvoiceAccountData AS piad WHERE piad.invoice_id = pi.id AND piad.providerBillingAccount_id = pi.billingAccount_id)
   >
  ((SELECT COALESCE(SUM(bat1.amount),0) FROM BankAccountTransaction AS bat1 WHERE bat1.deleted=false AND bat1.providerInvoice_id = pi.id)
     +
   (SELECT COALESCE(SUM(bats1.amount),0) FROM BankAccountTransactionSplit AS bats1 INNER JOIN BankAccountTransaction bat2 ON bats1.bankAccountTransaction_id=bat2.id WHERE bats1.deleted=false AND bat2.deleted=false AND bats1.providerInvoice_id = pi.id))


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list