The first query has the value inserted directly into the query string, 
whereas you use the bind() method to set the parameters in the second.

Setting parameters using the bind() method is surely the better 
practice. The question was out of curiosity. Actually, one of my 
co-workers asked me.

Thanks,
Bob

Bruce Snyder wrote:
> This one time, at band camp, Bob Lee said:
> 
> BL>When does Castor use prepared statements?
> BL>
> BL>For example, will:
> BL>
> BL>SELECT o FROM SomeObject o WHERE o.id = '1'
> BL>
> BL>and
> BL>
> BL>SELECT o FROM SomeObject o WHERE o.id = ?
> BL>
> BL>result in the same prepared statement?
> 
> Castor uses PreparedStatements for most of the queries to
> persistence. These queries are generated based on the mapping
> descriptor. As for your second question, I'm not sure I follow. In what
> context are these two queries used?
> 
> Bruce

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to