4
我有一個簡單的Address
模型的播放框架,但在調用ebean的#save()方法時,我得到以下錯誤。Playframework Ebean.Save()給連接關閉
數據庫配置正確我認爲(我可以讀取模型沒有問題)。我的單元測試在內存H2數據庫上運行的哪個工作正常。
代碼:
Address address = new Address(street, postalcode, location);
address.save();
播放輸出:
[error] c.j.b.ConnectionHandle - Database access problem. Killing off this connection and all remaining connections in the connection pool. SQL State = HY000
[error] play - Cannot invoke the action, eventually got an error: javax.persistence.PersistenceException: java.sql.SQLException: Connection is closed!
Address類
@Entity
public class Address extends Model {
@Id
public int id;
public String postalcode;
public String street;
public String location;
@OneToMany(cascade= CascadeType.ALL)
public List<Estate> estates;
public Address(String street, String postalcode, String location){
this.postalcode = postalcode;
this.street = street;
this.location = location;
}
public Address(int id, String street, String postalcode, String location){
this.id = id;
this.postalcode = postalcode;
this.street = street;
this.location = location;
}
public static Finder<Integer,Address> find = new Finder<Integer, Address>(
Integer.class, Address.class
);
}