1
The request:
@Entity
@Table(name="wp_posts")
public class Pedido implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private Long id;
@Column(name="post_status")
private String status;
@Column(name="post_type")
private String tipo;
@OneToMany(mappedBy = "pedido", cascade=CascadeType.ALL, orphanRemoval = true)
private List<PedidoMeta> pedidoMeta;
@OneToMany(mappedBy = "pedido", cascade=CascadeType.ALL, orphanRemoval = true)
private List<PedidoItem> itens;
@Column(name="post_date")
private Date data;
@Transient
private Usuario cliente;
The Controller:
@GetMapping(value = "/detalhePedido/{id}")
public ModelAndView detalhePedido( @PathVariable(value = "id", required = false) String pedidoid) {
pedido = pedidoRepository.findOne(new Long(pedidoid));
pedido = pedidoService.findCliente(pedido);
ModelAndView modelAndView = new ModelAndView("DetalhePedido");
modelAndView.addObject("pedido",pedido);
return modelAndView;
}
a View:
<tbody>
<tr th:object="${pedido}">
<td th:text="*{pedido.id}"></td>
<td th:text="*{pedido.cliente.nome}"></td>
<td th:text="*{#dates.format(pedido.data, 'dd-MM-yyyy')}"></td>
</tr>
</tbody>
The mistake:
org.springframework.expression.spel.SpelEvaluationException: EL1008E:
Property or field 'pedido' cannot be found on object of type 'com.ledolate.sys.model.Pedido' - maybe not public?
When debugging, the request is correct, with all the information, but when arriving at the display layer it presents this error.