public Result addHouse() {
House house = Form.form(House.class).bindFromRequest().get();
house.save();
return redirect(routes.Application.index());
}
// Above code calls the .save() method on the EntityBean to save it to the database - instead throwing error illegalArgument
import play.db.ebean.Model;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* Created by ctcmacadmin on 6/21/15.
*/
@Entity
public class House extends Model{
@Id
public String id;
public String owner;
public String address;
public String postalCode;
}
// Above code defines the House object as an JPA Entity
[IllegalArgumentException: Was expecting an EntityBean but got a class model.House]
// Above is the resulting error from calling the addHouse() Method
I don't know the play framework, but I think the error message is clear: It expects an instance where you have given a class.
As the only position of a class in your code is
Form.form(House.class)
: I would guess that it expects something likeForm.form(House.findById(...))
.