[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5225?page=c...
]
Raphaël Lemaire updated HHH-5225:
---------------------------------
Attachment: TestOrderBy.tgz
Hi,
If it helps, the problem doesn't occur on all database providers. I've encountered
it on MySQL, but not on Sybase ASE and HSQL with the same mapping.
The attached file is a compressed maven project that contains a configuration (JPA with
two entities) which makes the error appear (requires a local mysql server with a
"testorderby" database).
Hibernate 3.5.1-Final cannot parse order-by fragment
----------------------------------------------------
Key: HHH-5225
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5225
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.5.1
Environment: Hibernate 3.5.1-Final
MySQL 5.0
Spring 2.5
Reporter: Vladimir Kobetic
Priority: Critical
Attachments: TestOrderBy.tgz
When upgrading from Hibernate 3.2.5.ga to the newest Hibernate 3.5.1-Final with the
newest build-with dependent libraries an error occurs during initial phase of launching
application.
I tried to build and run with all libraries from lib directory from Hibernate zip
download.
The order-by clause is configured in hbm.xml:
<hibernate-mapping>
<class name="com.test.Object" table="err">
<id name="id" type="java.lang.Long">
<generator class="native" />
</id>
<set name="history" table="history" lazy="true"
order-by="timestamp desc" cascade="all-delete-orphan">
<key column="object_id" />
<one-to-many class="com.test.Event" />
</set>
</class>
</hibernate-mapping>
The exception is:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name
'sessionFactory' defined in class path resource
[applicationContext-dao-hibernate.xml]: Invocation of init method failed; nested exception
is org.hibernate.HibernateException: Unable to parse order-by fragment
Caused by: org.hibernate.HibernateException: Unable to parse order-by fragment
at
org.hibernate.sql.ordering.antlr.OrderByFragmentTranslator.render(OrderByFragmentTranslator.java:66)
at org.hibernate.sql.Template.renderOrderByStringTemplate(Template.java:310)
at
org.hibernate.persister.collection.AbstractCollectionPersister.<init>(AbstractCollectionPersister.java:557)
at
org.hibernate.persister.collection.OneToManyPersister.<init>(OneToManyPersister.java:84)
at
org.hibernate.persister.PersisterFactory.createCollectionPersister(PersisterFactory.java:104)
and more...
Caused by: java.lang.NullPointerException
at
org.hibernate.sql.ordering.antlr.OrderByFragmentParser.resolveFunction(OrderByFragmentParser.java:115)
at
org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.expression(GeneratedOrderByFragmentParser.java:619)
at
org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.sortKey(GeneratedOrderByFragmentParser.java:337)
at
org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.sortSpecification(GeneratedOrderByFragmentParser.java:248)
at
org.hibernate.sql.ordering.antlr.GeneratedOrderByFragmentParser.orderByFragment(GeneratedOrderByFragmentParser.java:192)
at
org.hibernate.sql.ordering.antlr.OrderByFragmentTranslator.render(OrderByFragmentTranslator.java:60)
... 38 more
--
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