我想知道在控制器中调用实体是否有良好的发展习惯。
示例:
实体:
@Entity
public class Project {
@Id
private Long id;
private String name;
private String type;
private boolean done = false;
//Getters & Setters
}
控制器
@Controller
public class ProjectController {
@RequestMapping(value = "/add", method = RequestMethod.GET)
public String addProject (Model model) {
model.addAttribute("entity", new Project());
return "addProject";
}
}
欢迎任何其他建议。