Hi Tom
Here is the controller code in either case with the response received:
public static void ordersByDate(String mydate) {
List<Order> orders = Order.find("SELECT orderNo,amount" +
" from Orders where date = ?", mydate).from(0)
.fetch(50);
renderJSON(orders);
}
Response is :
[
[
174434,
252
],
[
174479,
124
]
]
public static void ordersByDateJpa(String mydate) {
List<Order> orders = Order.find("byDate", mydate).from(0)
.fetch(50);
renderJSON(orders);
}
Response in this case:
[
{
"orderNo": 174434,
"amount": 252
},
{
"orderNo": 174479,
"amount": 124
}
]
In the first case, I believe List<Object> is being returned by the "find" method and in the second case, List<Order>.
So how do I make sure even for the first case, List<Order> gets returned other than looping through the List<Object> and casting it to "Order" type explicitly.
-Gokul