Bonjour,

Je développe un application avec Playframework 2.0.1, et je n'arrive pas à sauvegarder l'entité suivante :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package models;
 
import java.util.Calendar;
 
import javax.persistence.Entity;
import javax.persistence.Id;
 
import play.data.validation.Constraints.Required;
import play.db.ebean.Model;
 
@Entity
public class Reservation extends Model {
 
	@Id
	public Long id;
 
	@Required
	public Calendar startTime; 
 
	@Required
	public int duration; // in minutes
 
 
	public Reservation(Calendar startTime, int duration) {
		super();
		this.startTime = startTime;
		this.duration = duration;
	}
 
	public static Finder<Long, Reservation> find = new Finder<Long, Reservation>(Long.class, Reservation.class);
 
	public static Reservation create (Calendar startTime, int duration) {
		Reservation reservation = new Reservation(startTime, duration);
		reservation.save();
		return reservation;
	}
J'obtiens cette erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[InvalidPropertyException: Invalid property 'id' of bean class [models.Reservation]: No property 'id' found]]
	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.1]
	at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.1]
	at akka.actor.Actor$class.apply(Actor.scala:311) [akka-actor.jar:2.0.1]
	at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.1]
	at akka.actor.ActorCell.invoke(ActorCell.scala:619) [akka-actor.jar:2.0.1]
	at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:196) [akka-actor.jar:2.0.1]
Caused by: org.springframework.beans.InvalidPropertyException: Invalid property 'id' of bean class [models.Reservation]: No property 'id' found
	at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptor(BeanWrapperImpl.java:337) ~[spring-beans.jar:3.0.7.RELEASE]
	at play.db.ebean.Model._idAccessors(Model.java:32) ~[play_2.9.1.jar:2.0.1]
	at play.db.ebean.Model._getId(Model.java:52) ~[play_2.9.1.jar:2.0.1]
	at play.db.ebean.Model.hashCode(Model.java:183) ~[play_2.9.1.jar:2.0.1]
	at java.util.HashMap.put(HashMap.java:372) ~[na:1.6.0_33]
	at java.util.HashSet.add(HashSet.java:200) ~[na:1.6.0_33]
Si je ne me trompe pas, Play! est censé générer les ids automatiquement.
Quelqu'un aurait une idée ?

Merci d'avance.