[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3459) NullPointerException in Formatter.isFunctionName with certain SQL when pretty format is used
Gail Badner (JIRA)
noreply at atlassian.com
Wed Aug 17 22:50:02 EDT 2011
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3459?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gail Badner updated HHH-3459:
-----------------------------
Affects Version/s: 3.6.6
Issue Type: Patch (was: Bug)
> 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: Hibernate Core
> Issue Type: Patch
> Components: query-sql
> Affects Versions: 3.2.6, 3.6.6
> Reporter: Scott Feldstein
> Attachments: BasicFormatterImpl.patch
>
>
> 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.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list