我有以下课程:
@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();
}
}
它有someData
字段(播放框架会自动生成 getter 和 setter)。并且还在子句countClientsWithData
中使用此字段。where
现在如果我这样做
int count = Client.countClientsWithData();
NullPointerException
它会在尝试执行查询时抛出
select count(*) from clients t0 where inv.some_data > ?
看起来findRowCount
无法识别加入@Formula
注释。关于如何解决这个问题的任何想法?
更新的问题:缩小问题findRowCount
范围。