[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3362) NullPointerException in org.hibernate.dialect.Dialect$2.getReturnType

Geoffrey Wiseman (JIRA) noreply at atlassian.com
Thu Jul 2 13:47:15 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3362?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=33518#action_33518 ] 

Geoffrey Wiseman commented on HHH-3362:
---------------------------------------

Near as I can tell, I have the correct column here, and I'm getting this issue -- I'm not sure it's safe to close it.  At the very least, it needs good error detection and error message to explain WHAT the problem is, rather than an NPE deep in hibernate.

> NullPointerException in org.hibernate.dialect.Dialect$2.getReturnType
> ---------------------------------------------------------------------
>
>                 Key: HHH-3362
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3362
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.6
>         Environment: Hibernate Core 3.6.2 GA, hsqldb
>            Reporter: Istvan Kovacs
>         Attachments: bug_src.zip
>
>
> java.lang.NullPointerException
>         at org.hibernate.dialect.Dialect$2.getReturnType(Dialect.java:85)
>         at org.hibernate.hql.ast.util.SessionFactoryHelper.findFunctionReturnType(SessionFactoryHelper.java:382)
>         at org.hibernate.hql.ast.tree.AggregateNode.getDataType(AggregateNode.java:21)
>         at org.hibernate.hql.ast.tree.SelectClause.initializeExplicitSelectClause(SelectClause.java:143)
>         at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:705)
>         at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:529)
>         at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:645)
>         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)
>         at org.hibernate.console.HQLQueryPage.setSession(HQLQueryPage.java:106)
>         at org.hibernate.console.ConsoleConfiguration$4.execute(ConsoleConfiguration.java:388)
>         at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:65)
>         at org.hibernate.console.ConsoleConfiguration.executeHQLQuery(ConsoleConfiguration.java:383)
> [...] 
> 3 classes:
> Employee: Long ID; String name; Shop shop
> Shop: Long ID; String name; Set<Employee> employees; Map<Product, Integer> stock
> Product: Long ID; String name
> I mapped them to RDBMS using Hibernate. There's a table to hold stock info:
> SHOP_PRODUCT_STOCK - has fields SHOP_ID, PRODUCT_ID, AMOUNT
> SQL to query the average stock of each product:
> select p.name as name, avg(sps.amount) as avg_stock
> from Shop s, Shop_Product_Stock sps, Product p
> where sps.product_id=p.product_id and sps.product_id=p.product_id
> group by p.name
> order by p.name;
> Attempt in HQL that the produces exception:
> select p, avg(s.stock[p])
> from Shop s, Product p
> group by p
> I've also tried SELECTing and GROUPing BY p.id and p.name. None of the three variants work.

-- 
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