I mistakenly posted this question as an answer on a similar question (https://stackoverflow.com/questions/19956493/nested-double-loop-with-thymeleaf)
I have a class App
with a @ManyToOne
relationship with Cube
.
I'm trying to produce a table where each record represents an App
and within one of the cells would list out the related Cube
objects.
<tr th:each="app : ${apps}">
<td th:text="${app.id}">ID</td>
<td th:text="${app.name}">Name</td>
<td th:text="${app.description}">Description</td>
<td th:text="${app.url}">URL</td>
<td>
<ul>
<li th:each="cube : ${app.cubes}">
<span th:text="${cube.name}">Name</span>
</li>
</ul>
</td>
</tr>
I currently have 3 App
s in the database, each with 3-4 related Cube
s.
The App
rows are generating correctly, but the I am only getting a single Cube
item listed. As it happens, the id of both objects is 1
I noticed.