We have a well defined "actionsport" class that represent the following query result. And the query is
SELECT * FROM (
SELECT a.id,
s.name,
FROM ACTION as a,
SPORT as s
) WHERE rownum <=300;
I am stucked when try to cast the query result to the actionsport class.
I have used the following methods:
1.
Code:
Query q = getSession.createSQLQuery().addEntity(actionsport.Class)
And this does not work.
2. we modified the query to be
SELECT {acs.*} FROM .....
and
Code:
Query q = getSession.createSQLQuery().addEntity("acs",actionsport.Class)
And this does not work either.
3. we modified the query to be
SELECT {acs.*} FROM (
SELECT a.id as {acs.id},
s.name as {acs.name},
FROM ACTION as a,
SPORT as s
) WHERE rownum <=300;
And this does not work either.
4. we also changed the code
[code] Query q = getSession.createSQLQuery().addScalar("id", Hibernate.LONG).addScalar("name", Hibernate.CHARACTER)[\code]
There may be some typo errors but illustrate the main idea.
So my question is: is there a feasible way to make the result of a similar query (The one I used here) mapped to the java class object?
Any suggestion would be greatly appreciated.