I have following class:
@Entity
@Table(name = "clients")
public class Client extends Model {
@Id
public int id;
@Formula(select = "inv.some_data",
join = "left join (select 1 as some_data) as inv")
public int someData;
public static Finder<String, Client> find =
new Finder<String, Client>(String.class, Client.class);
public static int countClientsWithData() {
return Client.find.where().gt("someData", 0).findRowCount();
}
}
It has someData field (play framework will generate getters and setters automatically). And also countClientsWithData uses this field in where clause. Now if I do
int count = Client.countClientsWithData();
It will throw NullPointerException while trying to execute query
select count(*) from clients t0 where inv.some_data > ?
Looks like findRowCount doesn't recognize join in @Formula annotation. Any thoughts on how to work around this problem?
Updated question: narrowed down problem to findRowCount call.