“:P” 是什么意思? JDO 查询中的意思
我在谷歌应用程序引擎上使用 JDO。每个“员工”都有一把“钥匙”。我有一组密钥,想要检索密钥属于该组的所有员工。
因此,我使用指定的“contains()”过滤器来实现它在这里。代码工作正常,看起来像这样 -
List<Key> keys = getLookupKeys(....) ..//Get keys from somewhere.
Query query = pm.newQuery(Employee.class,":p.contains(key)"); //What is ":P" here?
List<Employee> employees = (List<Employee>) q.execute(keys); //This correctly gives me all I want
我想知道的是这个查询中的“:P”是什么? Employee 对象没有任何名为“p”的字段,我的查询也没有声明任何此类参数。那么这个“p”指向什么呢? 'p' 有什么特殊含义吗?
I am using JDO on google app engine. Each 'Employee' has a 'key'. I have a set of keys and wanted to retrieve all Employees whose key belongs to this set.
So I implemented it using the 'contains()' filter as specified here. The code works fine and looks like this -
List<Key> keys = getLookupKeys(....) ..//Get keys from somewhere.
Query query = pm.newQuery(Employee.class,":p.contains(key)"); //What is ":P" here?
List<Employee> employees = (List<Employee>) q.execute(keys); //This correctly gives me all I want
All that I wonder is what is this ":P" in this query? The Employee object does not have any field named 'p' neither my query declares any such parameter. So what does this 'p' point to? Does 'p' has any special meaning?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信它正在映射隐式输入参数。由于只有一个参数,因此不需要显式调用
setParameter
,直接使用即可。我相信它会因为:这可能更清楚。
有关另一个示例,请参阅 Apache JDOQL 文档 的“隐式参数”部分。
I believe it's mapping an implicit input parameter. As there's only one parameter, you don't need to explicitly call
setParameter
, you can just use it. I believe it would have been okay as:which might be clearer.
See the "implicit parameters" part of the Apache JDOQL docs for another example.