I have an oracle.toplink.expressions.Expression expression object with me that was created using oracle.toplink.expressions.ExpressionBuilder. I want to find its equivalent SQL query (for example, select emp.empname, emp.empId from the emp employee), which will eventually be run to receive the data. I want to find its equivalent Statement / PreparedStatement or something that helps me get the original SQL query that needs to be run.
For example, the following is the expression toplink:
expressionBuilder.get("empName").equal("Eric");
and I want to get the equivalent SQL query:
select emp.empName,emp.emp_id,emp.sal from employee emp where emp.empName like 'Eric'
Please let me know if there is any API for getting sol. I tried the implementation classes in DatabaseQuery, but couldn't find a way that could accomplish this.
The following is a toplink expression with me:
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('','') ...
,
Adithya.