Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Params on NamedNativeQuery

The JPA syntax for arguments in native queries is "?".

"SELECT * FROM City WHERE cityId=?"

or,
"SELECT * FROM City WHERE cityId=?1"

Named parameters (:name) are not allowed.  Although I agree it is confusing
that JPQL allows named parameters, and SQL queries do not, feel free to log
a bug for this.

You may also be able to use EclipseLink native argument syntax "#".

"SELECT * FROM City WHERE cityId=#cityId"


Edilson-2 wrote:
> 
> Thanks for your reply.
> 
> without quotes throws SQLSyntaxException, looks like eclipseLink does
> not mapping params, instead is executing plain query.
> 
> 
> -- 
> John Arévalo
> GNU/Linux User #443701
> http://counter.li.org/
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Params-on-NamedNativeQuery-tp20939353p20954108.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top