[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6578) BasicFormatterImpl Null Pointer Exception

Sylvain Vieujot (JIRA) noreply at atlassian.com
Wed Aug 17 05:28:03 EDT 2011


BasicFormatterImpl Null Pointer Exception
-----------------------------------------

                 Key: HHH-6578
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6578
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.6.6
            Reporter: Sylvain Vieujot
            Priority: Minor


When format_sql is true, BasicFormatterImpl throws a NPE for queries starting with brackets :

For the query :
(SELECT * FROM HtmlPageWithSectionDAOTest$TestEntity WHERE status=2 AND section='fr' ORDER BY sortOrder,title) UNION ALL (SELECT * FROM HtmlPageWithSectionDAOTest$TestEntity WHERE status=2 AND section='ar' AND alias NOT IN ( SELECT alias FROM HtmlPageWithSectionDAOTest$TestEntity WHERE status=2 AND section IN ('fr')) ORDER BY sortOrder,title)

I get the following exception :
java.lang.NullPointerException
	at org.hibernate.jdbc.util.BasicFormatterImpl$FormatProcess.isFunctionName(BasicFormatterImpl.java:374)
	at org.hibernate.jdbc.util.BasicFormatterImpl$FormatProcess.openParen(BasicFormatterImpl.java:355)
	at org.hibernate.jdbc.util.BasicFormatterImpl$FormatProcess.perform(BasicFormatterImpl.java:156)
	at org.hibernate.jdbc.util.BasicFormatterImpl.format(BasicFormatterImpl.java:91)
	at org.hibernate.jdbc.util.SQLStatementLogger.logStatement(SQLStatementLogger.java:109)
	at org.hibernate.jdbc.AbstractBatcher.log(AbstractBatcher.java:444)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:511)
	at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:452)
	at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:161)
	at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1700)
	at org.hibernate.loader.Loader.doQuery(Loader.java:801)
	at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
	at org.hibernate.loader.Loader.doList(Loader.java:2533)
	at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
	at org.hibernate.loader.Loader.list(Loader.java:2271)
	at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:316)
	at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1842)
	at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
	at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:157)
...

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