-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Return partial object from stored procedure
PostPosted: Sun May 02, 2010 11:13 pm 
Newbie

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.