我有两个表,table1(字段:playerId,insuranceId)和table2。
如何从表 2 中确定玩家 ID 和保险 ID 是否有相互连接?
我的意思是哪个玩家与哪家保险公司达成协议......
我知道我应该覆盖表中的方法(哪一个?)并使用table1存在方法来使其工作,但我不知道该怎么做。
我不确定我是否正确理解了您,但是您在 table2 上创建了下一个方法
public boolean existInTable1()
{
table1 t;
;
select recid from t where t.playerid == this.playerid && t.insuranceid == this.insuranceid;
return (t.recid !== 0);
}
在代码中的某个地方:
table2 t2;
;
select t2;
if(t2.existInTable1()) ...
更新
当然,如果你在table1上有exist-method,你可以像这样重写existInTable1():
public boolean existInTable1()
{
;
return table1::exist(this.playerid, this.insuranceid);
}