Search code examples
playframeworkebean

Cannot use find.where() in Ebean Model


I'm trying to use an Ebean finder inside of a model. When I try to do find.where() it errors saying it cannot resolve the method.

Model Code:

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()
    }
}

Edit: Like examples on this page

I've tried different formats and structures from other posts. Also tried creating a TestModelFinder extending Finder.


Solution

  • Looking at source code I don't think that Finder has such method. You should implement it by yourself like documentation says