You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Thomas Gilbert <th...@side-international.com> on 2007/07/20 21:14:52 UTC

Re: [SPAM Warning - SPF Alert] - Re: Named Queries with parameters on SQLServer - Sender is forged (SPF Fail)

Sounds great!

Thanks a lot for sharing this.

Thomas


On 20/07/07 20:47, "Andrus Adamchik" <an...@objectstyle.org> wrote:

> 
> On Jul 20, 2007, at 2:25 PM, Thomas Gilbert wrote:
> 
>> Dear All,
>> 
>> Do you have any hints about NamedQueries with parameters on
>> SQLServer ?
>> I created a named query "Q1", let's say "select * from T where x = ?".
>> How can I pass the parameter value to this query as it can only be
>> done via key/value pairs, and on SQLServer, parameters are not
>> name... ?
>> 
>> Thanks a lot
>> 
>> Thomas
> 
> Hi Thomas,
> 
> I assume your named query is mapped in the modeler as raw SQL?? If
> that's the case, named parameters are mapped using Cayenne format,
> that has nothing to do with syntax of the PreparedStatement (that it
> will will eventually generate). So your query SQL would look like this:
> 
> "select * from T where x = $myParameter"
> 
> so later you can use "myParameter" as a key name. You can read more
> here:
> 
>    http://cayenne.apache.org/doc20/scripting-sqltemplate.html
> 
> Again - $ variables is a Cayenne artifact, that is not related to
> JDBC or the underlying DB.
> 
> Andrus


------------------------------------------------------------------
CONFIDENTIALITY: This e-mail and any files transmitted with it are confidential and intended solely for the use of the recipient(s) only. Any review, retransmission, dissemination or other use of, or taking any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you have received this e-mail in error please notify the sender immediately and destroy the material whether stored on a computer or otherwise.

DISCLAIMER: Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of SIDE International S.A. - EastNets Group, unless otherwise specifically stated.
------------------------------------------------------------------