|
Re: Unable to create Criteria object or executeQuery: msg#00057jakarta.turbine.torque.user
Hi, I do remember there was a discussion about this in the user mailing list some time ago. The problem with your statement is that it uses subselects, which is not (yet ???) supported in torque (contributions are welcome). One solution was to manually create a view in the database, declare it in the project-schema.xml, run the generator to create the sql script which creates your tables, edit it manually to remove the sql statements which would interfere with your manually created view, and use the edited sql sript to create the tables. This may not be a solution if your sql is very dynamic. I have never used BasePeer.executeQuery(sqlString) myself, but I suspect that some preprocessing of the criteria object is necessary. However, your error sounds if there is some mistake in your Torque configuration. Are you able to do a simple table read using Torque ? Thomas "Pritam Paul" <pritam.paul@xxxxxxxxx> schrieb am 12.11.2004 15:27:43: > 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) ASPhaseName > > 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-user-unsubscribe@xxxxxxxxxxxxx > For additional commands, e-mail: torque-user-help@xxxxxxxxxxxxx > |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: BaseProjectProgram failed to instantiate ProjectProgram withi n JU nit: 00057, Angela Day |
|---|---|
| Next by Date: | RE: BaseProjectProgram failed to instantiate ProjectProgram withi n JU nit: 00057, Nicolas . CHALUMEAU |
| Previous by Thread: | Re: Unable to create Criteria object or executeQueryi: 00057, Guy Galil |
| Next by Thread: | Re: Unable to create Criteria object or executeQuery: 00057, Richard Bayet |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |