Is there any problem (security, consistency, bad practice etc) on returning the entity instead of a VO or DTO on Response of ajax call?
Small example:
JAVA:
@RequestMapping(method = RequestMethod.POST, value = "loadSomething.do")
public @ResponseBody RealEntity loadSomething(){
return service.getRealEntity();
}
JavaScript:
$.ajax({
type:'POST',
url: rquestURL,
cache: false,
success: function(realEntity) {
doSomething(realEntity);
}});
There is no problem in returning the entity. The purposes of a VO are different than those specified in this question.