[Hibernate-JIRA] Created: (HHH-6578) BasicFormatterImpl Null Pointer Exception
by Sylvain Vieujot (JIRA)
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
14 years, 7 months
[Hibernate-JIRA] Created: (HHH-3459) NullPointerException in Formatter.isFunctionName with certain SQL when pretty format is used
by Scott Feldstein (JIRA)
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....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months
[Hibernate-JIRA] Created: (HHH-6583) Schema validation fails on HSQLDB for @Type(type="text") fields
by Thilo-Alexander Ginkel (JIRA)
Schema validation fails on HSQLDB for @Type(type="text") fields
---------------------------------------------------------------
Key: HHH-6583
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6583
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.6.6
Environment: Hibernate 3.6.6, HSQLDB 2.2.4
Reporter: Thilo-Alexander Ginkel
When declaring an entity's field as
@Column(name = "description", nullable = true)
@Type(type="text")
the schema validation fails with the following error message on HSQLDB:
org.hibernate.HibernateException: Wrong column type in <table> for column description. Found: varchar, expected: longvarchar
at org.hibernate.mapping.Table.validateColumns(Table.java:283)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1343)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:378)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1872)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:855)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:774)
[...]
Apparently, HSQLDB maps the longvarchar column generated by Hibernate into a varchar(16M), which confuses the validator.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 7 months