Play Framework 2 Ebean Select Records, where Join Not Null / Empty

I have a very simple DB consisting (for this example) of two tables: UsersandUserOrders

I want to select a list of users where there is an association UserOrder(so custom orders are not NULL).

I tried to use .isNotNull(), but either I use it incorrectly, or it does not work as I expect.

For example, where userOrdersListis the name of the field @ManyToOnein the model:

List<User> User.find.where().isNotNull("userOrdersList").findList();

and where UserOrdersis the actual table name

List<User> User.find.where().isNotNull("UserOrders").findList();

I’m kinda going back to SQL, but as far as I remember, basically what I'm looking for is Left Exclusion Join (which means that it excludes any null results)

+3
source share

All Articles