Ebean Query by OneToMany Relationship

前端 未结 2 426
挽巷
挽巷 2021-01-03 02:14

I\'m using Ebean with the Play 2 Framework and got two models: a user model and a book model. The user model is connected with the book model in a OneToMany Relationship. So

2条回答
  •  醉梦人生
    2021-01-03 02:58

    List users = User.find.select("*")
                            .fetch("books")
                            .where()
                            .eq("t1.condition", "new")
                            .findList();
    

    For me, it works only when I use "t1.", I am using Postgres DB. The generated query makes sense with t1.

提交回复
热议问题