Tôi có thực thể sau:Persistence ngoại lệ khi sử dụng POJO ràng buộc trong điều khiển play framework
@Entity
public class Client extends Model{
public String email;
public String password;
}
Tôi đã điều khiển sau:
public static void clientSignUp(models.Client client)
{
info("Client email" + client.email);
info("Client password" + client.password);
client.create();
}
Khi điều khiển này được gọi là, hai bản ghi in ra đúng. Nhưng các lỗi dòng client.create với ngoại lệ ngủ đông này:
PersistenceException occured : org.hibernate.PropertyAccessException:
could not get a field value by reflection getter of models.Client.email
Tuy nhiên, khi tôi thay đổi mã nhẹ:
public static void clientSignUp(models.Client client)
{
models.Client client2 = new Client();
client2.email= client.email;
client2.password = client.password;
client2.create();
}
Nó hoạt động. Bất kỳ ý tưởng tại sao?