vertx-blueprint-todo-backend
vertx-blueprint-todo-backend copied to clipboard
getAll() in JdbcTodoService class returning raw resultset instead of mapped entity
I was trying to make this a maven project using vertx 4 Milestone 4 and modified the entity a bit. I didn't use codegen to generate the converter, instead i used Json.mapTo() to convert the resultset to list of entity. Other than these changes, the getAll() method is all the same as yours.
However, the endpoint is returning raw json, instead of list of entities. The map(Todo::new) is happening, but is not being returned.
I appreciate if you can guide me to some direction to resolve this.
edit: adding the entity
` public class Task {
@JsonProperty("task_id")
private int taskId;
@JsonProperty("created_at")
private LocalDate createdAt;
@JsonProperty("start_date")
private LocalDate startDate;
@JsonProperty("due_date")
private LocalDate dueDate;
private String title;
private String description;
private int status;
private int priority;
public Task(int taskId, String title, String description, LocalDate createdAt, LocalDate startDate, int status, LocalDate dueDate, int priority) {
this.taskId = taskId;
this.title = title;
this.description = description;
this.createdAt = createdAt;
this.startDate = startDate;
this.status = status;
this.priority = priority;
this.dueDate = dueDate;
}
public Task(Task other) {
this.taskId = other.taskId;
this.description = other.description;
this.createdAt = other.createdAt;
this.title = other.title;
this.startDate = other.startDate;
this.status = other.status;
this.priority = other.priority;
this.dueDate = other.dueDate;
}
public Task() {
}
public static Task converter(JsonObject object) {
return object.mapTo(Task.class);
}
//getters and setters } `