我收到此错误:[RuntimeException: No JPA EntityManagerFactory configured for name [default]] 当我尝试在数据库中创建操作搜索时。
模型 --- user.java
@Entity
public class User extends Model{
@Required
public String MaKH;
@Id
public Integer Id;
@MinLength(6)
public String Ten;
public String Diachi;
public Integer SDT;
public User() {}
public User(String MaKH,String Ten,String Diachi,Integer SDT,Integer Id){
this.Diachi=Diachi;
this.MaKH=MaKH;
this.Ten=Ten;
this.SDT=SDT;
this.Id=Id;
}
// Find method static for request
public static Finder<Long,User> find = new Finder(Long.class,User.class);
public static List<User> searchByName(String name){
return find.where().like("Ten", "%"+name+"%").findList();
}
}
控制器---Application.java
公共类应用程序扩展控制器{
public static Result index() {
return ok(index.render());
}
@Transactional
public static Result search() {
DynamicForm form = form().bindFromRequest();
String name = form.get("Ten");
User.searchByName(name);
return ok(result.render());
} }
路线
GET / controllers.Application.index()
POST /search controllers.Application.search()
应用程序.conf
db.default.driver=com.mysql.jdbc.Driver
db.default.url="jdbc:mysql://localhost/search"
db.default.user=root
db.default.password=123456
db.default.jndiName=DefaultDS
ebean.default="models.*"
请帮我解决它:D