[hibernate-issues] [Hibernate-JIRA] Created: (HCANN-46) Formula failed with quoted NamingStrategy

Stanislav Zaluzhskiy (JIRA) noreply at atlassian.com
Sat Apr 14 12:14:48 EDT 2012


Formula failed with quoted NamingStrategy
-----------------------------------------

                 Key: HCANN-46
                 URL: https://hibernate.onjira.com/browse/HCANN-46
             Project: Hibernate Commons Annotations
          Issue Type: Bug
    Affects Versions: 3.2.0
         Environment: Eclipse Helios
Spring 3.0.3
Hibernate-annotations 3.4.0 GA
            Reporter: Stanislav Zaluzhskiy


In my project I use specific NamingStrategy (org.hibernate.cfg.NamingStrategy).

Each column name is wrapped by quotas - _dialect.openQuote() + columnName + _dialect.closeQuote().

Then I try to use a @Formula with one of the property:

@Formula("(select sum(s.\"prodCount\") from SensorEntry as s where s.\"job_id\" = \"id\")")
private Long value;

This transforms into:
select sum(s.job_."prodCount") from SensorEntry as s where s.job_."job_id" = job_."id") as formula24_

Which leads to exception:
19:18:37,268  WARN main JDBCExceptionReporter:100 - SQL Error: 0, SQLState: 3F000
19:18:37,269 ERROR main JDBCExceptionReporter:101 - ERROR: schema "s" does not exist
19:18:37,270 ERROR main AbstractFlushingEventListener:324 - Could not synchronize database state with session
org.hibernate.exception.GenericJDBCException: unable to select generated column values
	at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
	at org.hibernate.persister.entity.AbstractEntityPersister.processGeneratedProperties(AbstractEntityPersister.java:3754)
	at org.hibernate.persister.entity.AbstractEntityPersister.processInsertGeneratedProperties(AbstractEntityPersister.java:3703)
	at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:89)
	at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)

I suppose that this is because quota literals don't escaped correctly by Hibernate.

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