Joined: Sun May 02, 2010 11:04 pm Posts: 2
|
I have a stored procedure that returns a partial set of fields of an entity - is it possible to map these results to a full entity ? I am aware this object if partial and it cannot be persisted but these results are for UI rendering (the entities can be serialized to XML ). I've read some mentions on this forum that resulttransformer can be used for something like this but I cannot figure out how ?
This is what I have
Entity:
class User { int id; string name; /.. other fields .../ }
SQL :
spGetUsers() / ... return { id, name } .../
Mapping:
<sql-query name="getUsers" callable="true"> /.... what should go here ? .../ { call spGetUsers() } </sql-query>
Query (from a REST resource)
@Get @Produces(xml) Collection<User> get() { return session.getNamedQuery("getUsers")./.. what here ? .../.list(); }
Thanks
|
|