The error message you get indicates a configuration problem - check your
Torque.properties.
After you are able to connect you can use your code as listed and get a
List of Reccord objects with your results - Torque cannot map multiple
tables to specific objects.
Another way would be to use Torque just to get the connection and then
process the query using plain jdbc:

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

....

Connection con = null;
Statement st = null;
ResultSet rs = null;
String query = "Select a from b where c = 'd' ";
try
{
        con = Torque.getConnection("default_database");
        st = con.createStatement();
        rs = st.executeQuery(query);
        while (rs.next()) 
        {
                // process results
        }
}       
finally
{
        if (rs != null)
                rs.close();
        if(st != null)
                st.close();     
        Torque.closeConnection(con);
}




                        
On Fri, 2004-11-12 at 09:27, Pritam Paul wrote:
> 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
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to