Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » createquery
createquery [message #390515] Wed, 22 July 2009 03:29 Go to next message
Enrico is currently offline Enrico
Messages: 82
Registered: July 2009
Member
Hi all,

I get an error when I try to create a query:

Query query = entityManager.createQuery(sql);
......
query.setParameter(i++, property1);
query.setParameter(i++, property2);
.....

my sql string is:

"select this from CfgEntity as this where this.idCfg=? and this.cfgName=?"

The errors in the createQuery call are:
line 1:53 mismatched character ' ' expecting set '1'..'9'
line 1:72 mismatched character '<EOF>' expecting set '1'..'9'

Any helps?

BR,
Enrico
Re: createquery [message #390516 is a reply to message #390515] Wed, 22 July 2009 03:46 Go to previous messageGo to next message
Enrico is currently offline Enrico
Messages: 82
Registered: July 2009
Member
sorry...I solved the problem....I jnote I forgot the index after the ?:

select this from CfgEntity as this where this.idCfg=?1 and this.cfgName=?2

BR,
Enrico


Enrico ha scritto:
> Hi all,
>
> I get an error when I try to create a query:
>
> Query query = entityManager.createQuery(sql);
> .....
> query.setParameter(i++, property1);
> query.setParameter(i++, property2);
> ....
>
> my sql string is:
>
> "select this from CfgEntity as this where this.idCfg=? and this.cfgName=?"
>
> The errors in the createQuery call are:
> line 1:53 mismatched character ' ' expecting set '1'..'9'
> line 1:72 mismatched character '<EOF>' expecting set '1'..'9'
>
> Any helps?
>
> BR,
> Enrico
>
Re: createquery [message #390520 is a reply to message #390516] Wed, 22 July 2009 07:47 Go to previous message
Doug Clarke is currently offline Doug Clarke
Messages: 155
Registered: July 2009
Senior Member
Enrico,

The em.createQuery method takes JPQL while the createNativeQuery method
takes SQL.

Doug
Previous Topic:DAO implementation: static?singleton?or instances?
Next Topic:use one connectio nper user - no connection pool
Goto Forum:
  


Current Time: Thu Aug 21 18:04:34 EDT 2014

Powered by FUDForum. Page generated in 0.01724 seconds