показать список в spring MVC с помощью thymleaf

#spring #spring-boot #thymeleaf

Вопрос:

Привет, я пытаюсь показать список в проекте Spring Boot с Thymleaf. Когда я позвоню http://localhost:8989/ben которые называют login2.html
Я получил в консоли другой порядок печати , я получил это в консоли , я должен получить тот же порядок в списке . Я не уверен, почему это происходит :

введите описание изображения здесь

login2.html :

 <!DOCTYPE html PUBLIC >
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8">
<title>Ads main</title>
<link type="text/css" href="/static/bootstrap/dist/css/bootstrap.css" rel="stylesheet" >
<link type="text/css" href="/static/css/style.css" rel="stylesheet" >
</head>
<body>
<div class="container">
   <table class="table table-striped">
     <thead>
       <tr> 
          <th>titre </th> 
          <th> corps</th> 
          <th> prix</th> 
          <th> id</th> 
       </tr>
      </thead>
      <tbody>
          <tr th:each="a:${annonces}">
            <td th:text="${a.titre}"> </td>
            <td th:text="${a.corps}"> </td>
            <td th:text="${a.prix}"> </td>
            <td th:text="${a.id}"> </td>
            <td > 
               <img class="imageAnnonceAdmin" alt="/static/images/no-image.gif" th:src="@{getPhoto(id=${a.id})}" onError="this.onerror=null;this.src='/static/images/no-image.gif';" />
            </td>
            <td > <a th:href="@{supprimer(id=${a.id})}" onclick="return confirm ('supprimer ? ')">Delete</a>  </td>
            <td > <a th:href="@{edit(id=${a.id})}">Edit</a>  </td>
          </tr>
      </tbody>
   </table>
  </div>
</body>
</html>
 

АннонсеДао :

 public interface AnnonceDao extends   JpaRepository<Annonce, Integer>,CrudRepository<Annonce,Integer> {
      
    Annonce findById(int id);
    Annonce getById(int id);
}
 

Annonce:

 public class Annonce implements Serializable,Comparable<Annonce> {
    
    private static final long serialVersionUID = 1L;
    @Id @GeneratedValue 
    Integer id;
    @Column(columnDefinition="TEXT")
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
    
    String titre;
    @Column(columnDefinition="TEXT")
    @Field(index = Index.YES, analyze = Analyze.YES, store = Store.NO)
    String  corps;
    String prix;
}
 

AnnonceController :

 @RequestMapping(value="/ben")
 public String listing(Model model) throws IOException
 {
     
     List<Annonce> annonces=annoncedao.findAllByOrderByDateDesc();
     System.out.println("list annoncs /ben :");
     for (Annonce ann: annonces) {
         System.out.println("- " ann.getTitre() " id " ann.getId());
     }
     model.addAttribute("annonces",annonces);
     return "thymeleaf/login2";
 }
public  String getPhoto(Integer id) throws InterruptedException, IOException  {
     
     System.out.println("idd ::" id);
     Annonce annonce=annoncedao.findById(id);
     System.out.println("annonce id ::" annonce.getId());
return "jsp/affiche"
}
 

Таблица базы данных :
введите описание изображения здесь