I know that it means I'm trying to call an instance method on the class, rather than an instance of the class (at least, I'm reasonably sure of that). The problem is that 'find' isn't mine, it's just something the tutorial tells me to use. The whole static versus non-static thing is confusing; some tutorials say to use it, then there are posts about how it's being removed in newer versions, then when you remove too many statics you suddenly get errors and have to put them back in for proper form handling.
If anyone knows where I'm going wrong with this, I'd appreciate a pointer. I'll paste all of Actor.java below, so you have it all, but it's mostly copied exactly from the afore mentioned tutorial. I just changed a few variable names.
//models\Actor.java:
package models;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import
javax.persistence.Id;
import play.data.validation.Constraints;
import play.db.ebean.*;
import java.util.*;
@Entity
public class Actor extends Model {
@Id
@GeneratedValue
public Long id;
@Constraints.Required
public String firstName;
@Constraints.Required
public String lastName;
public Short age;
public String role;
public Actor() {
}
public String toString() {
return "ID: "+id+". Name: "+firstName+" "+lastName+".";
}
public Model.Finder<Long, Actor> find = new Model.Finder(Long.class, Actor.class);
public static Actor findByID(Long _id) {
return find.where().eq("id", _id).findUnique();
}
public static List<Actor> findAll() {
return find.all();
}
}