I have a table that links a sale to a product with their id's, because sales and products is a many to many relationship, and I need to use that table as I normally do with a table when using thymeleaf. For example, if I want all the data in the table 'products', I do the following:
<tbody>
<tr th:each="producto:${productos}">
<td th:text="${producto.codigo_producto}"></td>
<td th:text="${producto.nombre}"></td>
<td th:text="${producto.marca}"></td>
<td th:text="${producto.costo}"></td>
<td th:text="${producto.cantidad_disponible}"></td>
</tr>
@GetMapping("/verproductos")
public String verProductos(Model model) {
model.addAttribute("productos",this.productoService.getAllProductos());
return "paginaproductos";
}
But in this case, I don't know how to do it because it is just the intermediate table that is automatically created with the @JoinTable annotation. How can I bring all the data from this table?.
I was trying to somehow get all from this table,just like the findAll() method , or something like that but I don't know how to access this table