I am currently playing around with a Spring MVC application, with two tables.
Student (id, name) and Publications (student_id, journal).
In my GET request, I am trying to request all of the Journals (String) of a given student ID. I believe in this case, I can simply do the following in my DAO without using any models:
@Override
public List<String> getAllJournals(String name) {
String query = "SELECT journal FROM Publications INNER JOIN Student ON "
+ "Publications.student_id = Student.id WHERE Student.name=:name";
Map<String,Object> params = new HashMap<String,Object>();
params.put("name", name);
List<String> journals = jdbcTemplate.queryForList(query, params, String.class);
return journals;
}
Should I be using the POJO for the Publication class or the Student class? Wouldn't this be redundant?