我有以下實體:持久性的異常使用POJO中發揮框架控制器綁定時
@Entity
public class Client extends Model{
public String email;
public String password;
}
我有以下控制器:
public static void clientSignUp(models.Client client)
{
info("Client email" + client.email);
info("Client password" + client.password);
client.create();
}
當這個控制器被調用時,兩個日誌打印出來正確。但client.create行錯誤與此休眠例外:
PersistenceException occured : org.hibernate.PropertyAccessException:
could not get a field value by reflection getter of models.Client.email
然而,當我稍微改變代碼:
public static void clientSignUp(models.Client client)
{
models.Client client2 = new Client();
client2.email= client.email;
client2.password = client.password;
client2.create();
}
它的工作原理。任何想法爲什麼?