【发布时间】:2015-02-10 09:39:56
【问题描述】:
我有我的超级抽象类:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class User {
@Id
public int id;
public String name;
}
另外两个类扩展了用户:
客户
@Entity
@Table(name = "customers")
public class Customer extends User{
@Id
public int id;
public String role;
public Customer(String role){
super();
this.role = role;
}
}
卖家
@Entity
@Table(name = "sellers")
public class Seller extends User{
@Id
@GeneratedValue
public int id;
public String role; // Seller
public Seller(String role){
super();
this.role = role;
}
}
我希望能够在游戏中使用 save() 方法,所以我写了这个:
public static Result saveCustomer(){
Customer customer = Form.form(Customer.class).bindFromRequest().get();
customer.save();
return ok();
}
但是,save() 没有定义。
解决这个问题的方法是什么?
【问题讨论】:
标签: java jpa playframework playframework-2.2 playframework-2.3