java - Ebean - Which find to use for multiple results? -


i using play framework , ebean, need find information inside 'value' column searching 'company_id'. however, there multiple rows same company_id , need find of them , put them in list (doesn't have list, make sense).

my table looks this:

+----+------------+-----------+-----------+ | id | company_id | parent_id |   value   | +----+------------+-----------+-----------+ |  1 |          1 |         0 | group1    | |  2 |          1 |         1 | subgroup1 | +----+------------+-----------+-----------+ 

and code :

@entity public class groups extends model {      private static final long serialversionuid = 1l;      @id     public long id;      public long company_id;      public long parent_id;      public string value;       public static final finder<long, groups> find = new finder<long,groups>(long.class, groups.class);      public static groups findbycompanyid(long id){         return find.where().eq("company_id", id).findunique();     } 

obviously, .findunique(); wont work not unique, should using? , should string value remain string?

ebean provides method findlist() returns list.

i think should give desired result:

public static list<groups> findbycompanyid(long id){     return find.where().eq("company_id", id).findlist(); } 

i unsure value column holds. if it's id of group can change type groups. require recursive queries ebean not support via api, have write raw sql that. if want avoid these recursive queries need groups via ebean , filter them in java.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -