0

I am having some trouble getting back all the rows in my table - Below you will see code for how I return one row (which works), and map it to a user object.

controller code

@GET
@Timed
@Path("/retrieve/{id}")
public User retrieveUserRecord(@PathParam("id") int id)
{
    User result = dao.findUserById(id);
    return result;
}

DAO code:

//Get User process record by id.
@SqlQuery("select * from users where ID = :id")
@Mapper(UserMapper.class)
User findUserById(@Bind("id") int id);

Thats great and all - But now I need to write another query that will return all User records in a list.

Thanks in advance for any help!

Slippy
  • 1,253
  • 5
  • 22
  • 43

1 Answers1

0

This should return all the users

 @SqlQuery("select * from users")
 @Mapper(UserMapper.class)
 List<User> fetchUsers();
Manikandan
  • 3,025
  • 2
  • 19
  • 28