Hi,
I would like to define multiple Named Queries where the only difference is the order by clause. I was thinking to define a common sql-query definition without an "order by" clause and then specify the different Named Queries with the appropriate "order by" clause.
Entity Definition
Code:
<!ENTITY SQL_QUERY "select person.id, person.name from t_person where office = :officeId">
Sql-query Definitions
Code:
<sql-query name="getPersons-name-asc" <![CDATA[ %SQL_QUERY% order by person.name asc]]>
<sql-query name="getPersons-id-desc" <![CDATA[ %SQL_QUERY% order by person.id desc]]>
When using the SQL query as such, i.e. without the ENTITY definition, everything works perfectly. When running a test with the ENTITY definition, Hibernate generates the following error: "could not locate named parameter [officeId]".
What am I doing wrong ?
Regards, Stefan Lecho.
Hibernate version:
3.2.5.ga