What is the best practice to send data to a view with Spring
framework, it is correct to send an entity to a view or first convert an entity to a disc.
This is because of the security issue, that not all the data in a table is necessary to send to the view.
Example: Vacancy Entity
@Id
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "nombre")
private String nombre;
@ManyToOne(optional = false)
private User idUsuario;
@Basic(optional = false)
User Entity:
@Basic(optional = false)
@Column(name = "id")
private Integer id;
@Basic(optional = false)
@Column(name = "nombre")
private String nombre;
and in the view simply bring the data like this:
Vacante.getId();
Vacante.getIdUsuario().getNombre();
Or create a data with the data that I just want to bring to the view and PASS THE DATA FROM THE ENTITY TO THE DEPT AND send this data to the view and not the entity.
As an additional piece of information I am using Vaadin
.