hibernate migration from 4 to 5
<p>I have used Hibernate 4 since a long time and now I need to upgrade to hibernate 5 and I have some trouble now with some named query:</p>

<pre><code>ERROR:   HHH000177: Error in named query: findByNumHeure
org.hibernate.hql.internal.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [ch.plugin.plugin.entity.Reservation]. Expected arguments are: ch.plugin.plugin.entity.Reservation, long [SELECT new Reservation(r, COUNT(r.numeroReservation)) FROM ch.plugin.plugin.entity.Reservation r WHERE r.numeroReservation =:num and r.reservationPK.heureDebutReservation = :heure GROUP BY r.numeroReservation HAVING r.reservationPK.heureDebutReservation = min(r.reservationPK.heureDebutReservation)]
</code></pre>

<p>and this is my named query:</p>

<pre><code>@NamedQuery(name = "findByNumHeure", query = "SELECT new Reservation(r, COUNT(r.numeroReservation)) FROM Reservation r WHERE r.numeroReservation =:num and r.reservationPK.heureDebutReservation = :heure GROUP BY r.numeroReservation HAVING r.reservationPK.heureDebutReservation = min(r.reservationPK.heureDebutReservation)"),
</code></pre>

<p>and of course, I have this constructor: </p>

<pre><code>public Reservation() {
}

public Reservation(Reservation reservation, Long etat) {
    this.reservationPK = reservation.getReservationPK();
    this.couleurReservation = reservation.getCouleurReservation();
    this.iDRecurrence = reservation.getIDRecurrence();
    this.isPaye = reservation.getIsPaye();
    this.numeroReservation = reservation.getNumeroReservation();
    this.responsable = reservation.getResponsable();
    this.texte = reservation.getTexte();
    this.etat = etat.intValue();
    this.prix = reservation.getPrix();
}
</code></pre>

<p>So my question is: Why it was working well in Hibernate 4 and now this is not working any more with Hibernate 5? And the code is exactly the same?</p>