gpt4 book ai didi

toplink - 来自 Toplink 表达式的 SQL 查询

转载 作者:行者123 更新时间:2023-12-02 02:27:19 25 4
gpt4 key购买 nike

我有一个 oracle.toplink.expressions.Expression 表达式对象,它是使用 oracle.toplink.expressions.ExpressionBuilder 创建的。我想找到它的等效 SQL 查询(比如从员工 emp 中选择 emp.empname、emp.empId),最终将被触发以获取数据。我想找到它的等效 Statement/PreparedStatement 或任何可以帮助我获取即将被触发的原始​​ SQL 语句的东西。

例如以下是 toplink 表达式:

expressionBuilder.get("empName").equal("Eric");

我想获得等效的 SQL 查询:

select emp.empName,emp.emp_id,emp.sal from employee emp where emp.empName like 'Eric'

请告诉我是否有任何 API 来获取 sol。我尝试了 DatabaseQuery 的实现类,但找不到任何可以实现此目的的方法。

下面是我的toplink表达式:

Logical operator  AND 
Logical operator AND
Logical operator AND
Logical operator AND
Logical operator AND
Logical operator AND
Logical operator AND
Logical operator AND
Relation operator <
Query Key minEffectiveBegDate
Base com.altra.common.data.OperationalTrxData
Constant Tue Feb 01 08:00:00 CST 2011
Relation operator >
Query Key maxEffectiveEndDate
Base com.altra.common.data.OperationalTrxData
Constant Sat Jan 01 08:00:00 CST 2011
Relation operator <
Query Key begDate
Query Key calculatedQuantityDataList
Query Key qtyClassificationDataList
Query Key operationalQuantityDataList
Base com.altra.common.data.OperationalTrxData
Constant Tue Feb 01 08:00:00 CST 2011
Relation operator >
Query Key endDate
Query Key calculatedQuantityDataList
Query Key qtyClassificationDataList
Query Key operationalQuantityDataList
Base com.altra.common.data.OperationalTrxData
Constant Sat Jan 01 08:00:00 CST 2011
Relation operator =
Query Key opsTrxClassification
Base com.altra.common.data.OperationalTrxData
Constant -5001579
Relation operator =
Query Key accountingCompany
Base com.altra.common.data.OperationalTrxData
Constant 1196
Logical operator OR
Logical operator AND
Relation operator =
Query Key sourceRelatedNodeObjType
Base com.altra.common.data.OperationalTrxData
Constant -2094
Relation operator IN
Query Key sourceRelatedNodeObjId
Base com.altra.common.data.OperationalTrxData
Constant [4187]
Logical operator AND
Relation operator =
Query Key dispositionRelatedNodeObjType
Base com.altra.common.data.OperationalTrxData
Constant -2094
Relation operator IN
Query Key dispositionRelatedNodeObjId
Base com.altra.common.data.OperationalTrxData
Constant [4187]
Relation operator =
Query Key qtyType
Query Key operationalQuantityDataList
Base com.altra.common.data.OperationalTrxData
Constant -5000328
Relation operator =
Query Key qtyStatus
Query Key qtyClassificationDataList
Query Key operationalQuantityDataList
Base com.altra.common.data.OperationalTrxData
Constant -5000316

我想要类似的 SQL

select otd.operationaltrx_id,otd.accountingCompany from OperationalTrxData otd where minEffectiveBegDate > to_date('','') ...

谢谢,阿迪提亚。

最佳答案

使用 ReportQuery 选择所需的字段,然后“准备”查询并打印出将生成的 SQL:

ExpressionBuilder emp = new ExpressionBuilder(Employee.class);
ReportQuery query = new ReportQuery(Employee.class, emp);
query.addAttribute("empName");
query.addAttribute("emp_id");
query.addAttribute("sal");

query.setSelectionCriteria(emp.get("empName").equal("Eric"););
query.prepareCall(session, new DatbaseRecord());
String sql = query.getSQLString();

关于toplink - 来自 Toplink 表达式的 SQL 查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5401720/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com