|
|
|
[
Permlink
| « Hide
]
Diego Plentz - 17/Sep/07 09:50 PM
Already tried with 3.2.5?
No. This problem is not reproducible at will. The problem shows up occasionally during our automated tests execution. Automated tests are executed daily and once in a month (sometimes twice) the test fails with similar error. There is no easy way for me to try 3.2.5 unless the version is change for the project. Change in hibernate version would impact entire project. If there is evidence that moving to 3.2.5 would resolve this issue then I can make the proposal for upgrading hibernate. For that I would need information on what has changed that would prevent this issue from happening with 3.2.5. Thanks,
Well, if you cannot reproduce the error, I will close the issue (we cannot solve a problem that we cannot understand). If you provide a *running* test case I will reopen the issue.
try using keyword "this" in sort property name:
HibernateUtil.getSession().createCriteria(SystemBean.class) .addOrder(Order.asc("this.name")).list(); Our system is running in Japanese locale + Hibernate 3.2.4sp1,
and we met exactly the same problem. In the meantime, I can not create test case to reproduce problem but if more than 1 man meet the same problem, may be it's a real bug. I met the same problem.
I use 3.2.4.sp1, oracle 10g. As i know, let's the reason of the problem occurs. Using Criteria for query, if you apply a Projection to a query, then use Restrictions to narrow the result set, and the defined Projection property same as the defined Restrictions property, the sql generated by hibernate will have the wrong alias. If you don't apply Projections, no problem. Here is the code: Criteria criteria = createCriteria(Project.class); 1. criteria.setProjection(Projections.projectionList().add(Projections.property("name"), "name")); 2. criteria.add(Restrictions.like("name", "ttilyf", MatchMode.ANYWHERE)); criteria.addOrder(Order.desc("id")); criteria.list(); sql: select this_.name as y0_ from project this_ where y0_ like ? and 1=1 order by this_.id desc error info: ORA-00904: y0_: invalid identifier And if remove line 1 or 2, that ok. Now change line 1 to criteria.setProjection(Projections.projectionList().add(Projections.property("name")); or criteria.setProjection(Projections.projectionList().add(Projections.property("name"), "alias_name")); it's ok. sql: select this_.name as y0_ from project this_ where this_.name like ? and 1=1 order by this_.id desc Now, i think everyone know how to avoid this problem. ps:sorry for my suck english. |
||||||||||||||||||||||||||||||||||||||||||||||||||||