You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by Pritam Paul <pr...@lycos.com> on 2004/11/12 15:40:42 UTC
Unable to create Criteria object or executeQuery
Hi,
I have the following sql statement whose equivalent i need to
generated using Criteria settings to fetch the results:
[THIS SQL Query works well in SQL Server and Query explorer - to
fetch 8 records]
-----------------------------------------------------------------
SELECT PME_EmpInfo.EMPLOYEEID,
PME_EmpInfo.FIRSTNAME,
PME_EmpInfo.LASTNAME,
PME_EmpInfo.SUPERVISORID,
PME_EmpInfo.DEPTNO,
PME_EmpInfo.DEPTNAME,
(SELECT (empinner.FirstName + ' ' + empinner.LastName)
FROM PME_EmpInfo empinner
WHERE PME_EmpInfo.SUPERVISORID =
empinner.EmployeeID) AS SupervisorName,
(SELECT phaseinner.PhaseName
FROM PME_Phase phaseinner
WHERE PME_Main.CURRENTPHASEID =
phaseinner.PhaseID) AS PhaseName
FROM PME_EmpInfo INNER JOIN
PME_Main ON PME_EmpInfo.EMPLOYEEID = PME_Main.EMPLOYEEID INNER JOIN
PME_Phase ON PME_Main.CURRENTPHASEID = PME_Phase.PHASEID
WHERE (PME_Main.CURRENTSTATUSID='7') AND
(PME_EmpInfo.DEPTNO='11080')
-----------------------------------------------------------------
I tried using Criteria class but since i dont know Torque well i dont
know how
this can be achieved using the Criteria class. I tried creating a
Query object
for this SQL statement and its (.toString()) method outputs this
exact SQL query.
But how do i execute this query to fetch the results.
When i try using the BasePeer.executeQuery(sqlString) method, it
complains "There was no DataSourceFactory configured for the
connection".
Also how would i get the resultset object casted in such a way that i
can read the mentioned columns.
In summary - how to execute a raw sql statement (which was generated
by some other
app layer) using torque and get the resultset?
Any help is greatly appreciated.
regards,
Paul
--
--
_______________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org