Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » createquery
createquery [message #390515] Wed, 22 July 2009 03:29 Go to next message
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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 Jul 24 20:55:19 EDT 2025

Powered by FUDForum. Page generated in 0.05018 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top