jcr*_*son 17 java mysql ebean playframework-2.0
我希望拥有比我更多Ebean专业知识的人可以帮助我解决我现在正在排除故障的不稳定问题.
环境:
我的主要问题是当我重新启动Play时,我正在交替使用SQLExceptions,所有这些都与Ebean正在创建的预准备语句中的参数太多或太少有关.数据集A在数据集B失败的情况下工作一半,但在重新启动Play时,数据集B在数据集A失败时工作.
我正在根据我写入传递给函数的一组Filter对象动态构建一个Ebean Query对象.Ebean查询正在查找满足每个Filter的给定要求的所有对象.
该功能类似于:
private List<Contact> contacts getContacts(Set<Filter> filters) {
Query<Contact> query = Contact.find;
for (Filter filter : filters) {
filter.apply(query);
}
List<Contact> contacts = query.findList();
}
Run Code Online (Sandbox Code Playgroud)
过滤器的示例:
public void apply(Query<Contact> query) {
query.where().in("tags", getTags());
}
Run Code Online (Sandbox Code Playgroud)
首先,Ebean支持这种类型的查询构建吗?我相信这是因为大多数时候这是有效的,然而,我遇到了使用某些数据运行"getContacts"函数数百次的问题,但有时只是......
所以坚持我,因为这个问题非常令人困惑.我还将介绍数据实际上的大部分细节,但如果您需要/需要更多信息,请询问.
数据集A的查询和异常:
select distinct t0.contact_id c0, t0.contact_uuid c1, t0.bounce c2
from contact t0
join email_record u1 on u1.contact_id = t0.contact_id
join contact_tag u2z_ on u2z_.contact_id = t0.contact_id
join tag u2 on u2.tag_id = u2z_.tag_id
where u1.status = ? and t0.unit_id = ? and u2.tag_id in (?,?,?) and t0.unit_id in (? ) and t0.campaign_id in (?,?,?,?,?,?,?,?,?,?,?,?)
[PersistenceException: Error with property[19] dt[4]data[1464][java.lang.Integer]]
Caused by: java.sql.SQLException: Parameter index out of range (19 > number of parameters, which is 18).
Run Code Online (Sandbox Code Playgroud)
然后在Play重启后,数据集B的查询和异常:
[PersistenceException: Query threw SQLException:No value specified for parameter 19 Bind values:[SENT, 1290, 8988, 13032, 13052, 1290, 96, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 222] Query was: select distinct t0.contact_id c0, t0.contact_uuid c1, t0.bounce c2 from contact t0 join email_record u1 on u1.contact_id = t0.contact_id join contact_tag u2z_ on u2z_.contact_id = t0.contact_id join tag u2 on u2.tag_id = u2z_.tag_id where u1.status = ? and t0.unit_id = ? and u2.tag_id in (?,?) and t0.unit_id in (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) and t0.campaign_id in (?,?,?,?,?,?,?,?,?,?,?,?) ]
Run Code Online (Sandbox Code Playgroud)
我觉得最令人困惑的是它如何在重启时100%可靠地切换.
有没有人见过这样的事情呢?只是为了增加混乱,它还在我们的生产环境中做了非常类似的事情(在不同的数据集上),但即使在转储数据库并在本地加载它之后,我也无法在我的开发或测试机器上重现这一点.上述问题虽然可以在任何地方重现.
| 归档时间: |
|
| 查看次数: |
1917 次 |
| 最近记录: |