【问题标题】:Cannot use find.where() in Ebean Model无法在 Ebean 模型中使用 find.where()
【发布时间】:2019-03-10 11:59:35
【问题描述】:

我正在尝试在模型中使用 Ebean finder。当我尝试执行 find.where() 时,错误提示它无法解析该方法。

型号代码:

package models;

import io.ebean.Finder;
import io.ebean.Model;
import play.data.validation.Constraints;

import javax.persistence.*;

@Entity
public class TestModel extends Model {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long id;

    @Column(length = 256, unique = true, nullable = false)
    @Constraints.MaxLength(256)
    @Constraints.Required
    private String testField;


    public static final Finder<Long, TestModel> find = new Finder<>(TestModel.class);

    public void testFunction() {
        find.where() // Error: Cannot resolve method where()
    }
}

编辑:像this page 上的示例

我尝试了与其他帖子不同的格式和结构。还尝试创建一个扩展 Finder 的 TestModelFinder。

【问题讨论】:

    标签: playframework ebean


    【解决方案1】:

    看着source code我不认为Finder有这种方法。你应该自己实现它,比如documentation says

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-25
      相关资源
      最近更新 更多