I have weird problem. Here is my java class
public Profile{
public Person person;
public Person personHead;
public Person DeptHead;
}
Now when I search for the following
List _results = (List)session.createCriteria(Profile.class)
.createAlias("person","person")
.addOrder(Order.asc("person.lastName"))
.list();
Error message
**************
SEVERE: ORA-00904: "PERSON1_"."LASTNAME": invalid identifier
Query-->select * from T_PROFILE this_ order by person1_.lastName desc
Where the following two works fine.
------------------------------------------------------------------------------
List _results = (List)session.createCriteria(Profile.class)
.createAlias("personHead","person")
.addOrder(Order.asc("person.lastName"))
.list();
Hibernate: select * from T_PROFILE this_ inner join T_PERSON person1_ on this_.personHead=person1_.id
order by person1_.lastName asc
List _results = (List)session.createCriteria(Profile.class)
.createAlias("DeptHead","person")
.addOrder(Order.asc("person.lastName"))
.list();
This works fine.
-------------------------------------------------------------------------------
I have tried this. Still the same error message is coming:
List _results = (List)session.createCriteria(Profile.class)
.createAlias("person","per")
.addOrder(Order.asc("per.lastName"))
.list();
Is there any problem with createAlias method? It is giving error message when I give same name for alias and property?
Thanks
|