Reputation: 11
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
Upvotes: 0
Views: 1192
Reputation: 11
Have you included @Table
annotation?
I encountered the same issue; it got resolved with @Table
annotation.
Ex:-
@Table(name = "[your table name]")
Upvotes: 1
Reputation: 460
You are using Ebean with play framework, and you are missing bean finder here. Take a look at the following link.
Upvotes: 0
Reputation: 9022
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 like Form.form(House.findById(...))
.
Upvotes: 0