this is my Topic’s data members:
public class Topic extends Model {
@Id
protected long id;
public String title;
public String content;
@ManyToOne
@JoinColumn(name = "forumId")
public Forum forum; // this is a reference to the topic's forum.
forum attribute saved in postgresql as bigint (the id of the Forum class)
this is my Finder for Topic:
public static Finder<Long,Topic> find = new Finder<Long,Topic>(Long.class, Topic.class);
now, I’m trying the simplest thing using Finder. retrieve Topics by forum id.
I tried many variations, this is one of them:
public static List<Topic> getTopicsByForum(long id) {
Forum forum = Forum.getById(id);
return find.where().gt("forumId", forum).findList();
}
I get wrong results. I must do something wrong but don’t know what.
With Ebean, you can access properties directly, so try this: