Hi buzz_buzz,
You could create a lightweight data transfer object (DTO) that could contain
the information that you're interested in getting across the wire in your
RPC call. For example, the getStocks() method signature could be changed to:
public StockDataTransferObject[] getStocks() throws NotLoggedInException {
...
List<StockDataTransferObject> stockDTOs = new
ArrayList<StockDataTransferObject>();
try {
...
List<Stock> stocks = (List<Stock>) q.execute(getUser());
for(Stock stock : stocks) {
stockDTOs.add(new StockDataTransferObject(stock.getSymbol(),
stock.getOtherData()));
}
} finally {
...
}
return (StockDataTransferObject[]) stockDTOs.toArray(new
StockDataTransferObject[0]);
}
Hope that helps,
-Sumit Chandel
On Thu, Aug 6, 2009 at 9:36 PM, buzz_buzz <[email protected]> wrote:
>
> i am new with GWT. i successfully try compile and upload stockwatcher
> application to the google app engine. i alsoa can save and query all
> data save in the data store. recently i add 1 more field at stock app
> engine data store. i add symbol2. user can save 2 symbol. the problem
> is. i dont know how can i extract symbol2 field. Tutorial provided by
> google only show extract 1 field only. how can i extract/query more
> than 1 field. please help.
>
> Attached code from stockwatcher at server side (StockServiceImpl): -
>
> public String[] getStocks() throws NotLoggedInException {
> checkLoggedIn();
> PersistenceManager pm = getPersistenceManager();
> List<String> symbols = new ArrayList<String>();
> try {
> Query q = pm.newQuery(Stock.class, "user == u");
> q.declareParameters("com.google.appengine.api.users.User u");
> q.setOrdering("createDate");
> List<Stock> stocks = (List<Stock>) q.execute(getUser());
> for (Stock stock : stocks) {
> symbols.add(stock.getSymbol());
> }
> } finally {
> pm.close();
> }
> return (String[]) symbols.toArray(new String[0]);
> }
>
>
> its clearly the code only extract 1 field. how to extract another
> field.. Thanks
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---