java - How can I get a count from a related table in Hibernate -


i have 2 simple pojos placed in many 1 relation

@entity public class meeting {      @id     @generatedvalue(strategy = generationtype.identity)     private int meetingid;     private string title;     @manytoone     private location location;     ... 

and

@entity public class location {      @id     @generatedvalue(strategy = generationtype.identity)     private int locationid;     private string name;     ... 

i'm wondering need count of meetings inside locationlist below

    session session = hibernatehelper.getsessionfactory().opensession();     session.begintransaction();     list<location> locationlist = session.createcriteria(location.class).list(); 

i've thinked of definig @transient meetingscount inside location pojo don't know how go on in order tell hibernate retrieve me.

i know how information making explicit query not i'm looking for


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -