Let's assume that I have 2 entities: question and user and I want to return object that have questions and user information. How can I ask Ebean to make join and bind result to new class? (My intent that there will be 1 select join query to db, instead of fetching Questions and then for each issue query to bind user info to them).
For example:
@Entity
class User extends Model {
String name;
@ManyToOne
@LazyLoad
List<Questions> questions;
}
@Entity
class Question extends Model {
String question;
@OneToMany
@LazyLoad
User user;
}
@????
class QuestionUserResult {
String question;
String userName;
}
Ebean.find(QuestionUserResult.class) ????? // Intent there to have "select * from question inner join user on ...... "
Most examples on the web dealing with filtering. I do not care in this case about where condition.
Thanks for answers.