[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3459) NullPointerException in Formatter.isFunctionName with certain SQL when pretty format is used

Scott Feldstein (JIRA) noreply at atlassian.com
Wed Sep 3 03:17:07 EDT 2008


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

Scott Feldstein commented on HHH-3459:
--------------------------------------

apologies, it should say "while exec'ing sql with parentheses around the stmt"

> NullPointerException in Formatter.isFunctionName with certain SQL when pretty format is used
> --------------------------------------------------------------------------------------------
>
>                 Key: HHH-3459
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3459
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: query-sql
>    Affects Versions: 3.2.6
>            Reporter: Scott Feldstein
>
> A NullPointerException is thrown when hibernate.show_sql=true && hibernate.format_sql=true while exec'ing sql with quotes around the stmt:
> (taken from an embedded groovy script)
> ---------
> def sess = getSession()
> def HQL = """
> (select count(*) from TABLE)
> """
> sess
> .createSQLQuery(HQL)
> .list()
> ------------
> This is valid SQL and is typically used in my app as such:
> (select count(*) from TABLE1) UNION ALL (select count(*) from TABLE2) ...
> Here is the stack trace in hibernate:
> java.lang.NullPointerException
> 	at org.hibernate.pretty.Formatter.isFunctionName(Formatter.java:342)
> 	at org.hibernate.pretty.Formatter.openParen(Formatter.java:323)
> 	at org.hibernate.pretty.Formatter.format(Formatter.java:134)
> 	at org.hibernate.jdbc.AbstractBatcher.format(AbstractBatcher.java:410)
> 	at org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:404)
> 	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:482)
> 	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
> 	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
> 	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
> 	at org.hibernate.loader.Loader.doQuery(Loader.java:673)
> 	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
> 	at org.hibernate.loader.Loader.doList(Loader.java:2220)
> 	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
> 	at org.hibernate.loader.Loader.list(Loader.java:2099)
> 	at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
> 	at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
> 	at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
> 	at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)

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