Hibernate issue
Yesterday I have work with hibernate and realted stuff. I worked with some Entety class created property, that was defined by some formula. Something like this
<property name="propertName" formula="'test'">
So as you can see property is some kind of constant in this example. After this I have tried to create Criteria to SELECT some objects of this class from database, and order it by my shiny new property, with something like this
resultCrit.addOrder(Order.asc("propertyName"));
And I have got error from postgresql about ORDER BY clause. After looking in what kind of SQL query
hibernate tring to create, I have find out that it tring to execute something like this
SELECT field1, field2, 'test' as t FROM table_name ORDER BY 'test'
It absolutly obvious that insted of 'test' hibernate should use t in ORDER BY clause. Looks like bug for me.
<property name="propertName" formula="'test'">
So as you can see property is some kind of constant in this example. After this I have tried to create Criteria to SELECT some objects of this class from database, and order it by my shiny new property, with something like this
resultCrit.addOrder(Order.asc("propertyName"));
And I have got error from postgresql about ORDER BY clause. After looking in what kind of SQL query
hibernate tring to create, I have find out that it tring to execute something like this
SELECT field1, field2, 'test' as t FROM table_name ORDER BY 'test'
It absolutly obvious that insted of 'test' hibernate should use t in ORDER BY clause. Looks like bug for me.

0 Comments:
Post a Comment
<< Home