You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用GemFire OQL查询员工对象列表内的指定属性

Querying Nested Experience Attributes in GemFire OQL

Got it, let's tackle this GemFire OQL query for extracting nested experience attributes from your Employee objects. Here's how you can do it based on different use cases:

1. Fetch all experience details for a specific employee

If you want to pull out all the org, fromDate, and toDate values for a single employee (by employeeId), use the ELEMENT keyword to flatten the nested experience collection. This ensures each experience entry is returned as a separate result row instead of a nested collection:

SELECT EXP.org, EXP.fromDate, EXP.toDate
FROM /Employee e, ELEMENT e.employeeExperienceList.experience EXP
WHERE e.employeeId = '592266'

If you prefer to get the full experience objects instead of individual attributes, simplify the query to:

SELECT EXP
FROM /Employee e, ELEMENT e.employeeExperienceList.experience EXP
WHERE e.employeeId = '592266'

2. Fetch experience details across all employees

To retrieve experience data for every employee in your GemFire region, remove the WHERE clause and include the employeeId in the select to link each experience to its employee:

SELECT e.employeeId, EXP.org, EXP.fromDate, EXP.toDate
FROM /Employee e, ELEMENT e.employeeExperienceList.experience EXP

3. Filter experience records with specific criteria

You can add additional filters to narrow down results—for example, finding all experiences from a specific organization or within a date range:

SELECT e.employeeId, EXP.org, EXP.fromDate, EXP.toDate
FROM /Employee e, ELEMENT e.employeeExperienceList.experience EXP
WHERE EXP.org = 'XYZ' 
  AND EXP.fromDate >= DATE '2010-01-10'

Note: If your date fields are stored as strings instead of GemFire DATE types, adjust the comparison to use string matching (e.g., EXP.fromDate >= '2/3/2014').

Key Notes

  • Replace /Employee with your actual GemFire region name if it differs.
  • The ELEMENT keyword is critical here—it iterates over each entry in the employeeExperienceList collection, avoiding nested result sets.
  • Ensure your OQL uses the exact attribute names from your Employee and Experience objects (case sensitivity matters in GemFire OQL).

内容的提问来源于stack exchange,提问作者Arijit Dasgupta

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 12:00:53