尝试绑定表单请求时,我得到此illegalStateException没有值。我认为它与我的联系人模型有一对多映射,我不知道如何处理bindfromquestion。任何例子都会有帮助。
谢谢, 添
我的模特是:
@Entity
public class Contact extends Model {
@Id
public long id;
public String firstName;
public String lastName;
public String prefix;
public String role;
public String organization;
public String website;
public Date lastModDate;
@OneToMany(mappedBy = "contact")
public List<Address> address;
@OneToMany(mappedBy = "contact")
public List<Email> email;
@OneToMany(mappedBy = "contact")
public List<PhoneNumber> phoneNumber;
}
控制器:
public static Result save(){
Form<Contact> boundForm = contactForm.bindFromRequest();
Contact contact = boundForm.get();
contact.save();
return ok(String.format("Saved contact %s", "contact"));
}