The Query object is not able to return SQL code, as it does not have any
platform specific know how.
You have to ask the OJB SqlGenerator component to generate SQL:

PersistenceBroker broker = ...
Query query = ...;
ClassDescriptor cld = ...;

// obtain prepared stmt sql:
String sql = broker.serviceSqlGenerator().getPreparedSelectStatement(query,
cld);

// obtain no prepared sql: 
sql = broker.serviceSqlGenerator().getSelectStatementDep(query, cld);

cheers,
thomas

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 17, 2003 10:32 AM
> To: [EMAIL PROTECTED]
> Subject: how to obtain the SQL code from a Query object?
> 
> 
> Hello,
> 
> I have this query:
> 
> ----code----
> Criteria crit = new Criteria();
> crit.addEqualTo("workstationName", "U68111");
> 
> Query query = new QueryByCriteria(Workstation.class, crit, true);
> ----code----
> 
> Is there a way to obtain the SQL query (select * from 
> Workstation where....) from the query object?
> 
> Thanks
> Sylvain
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


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

Reply via email to