Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » query conflicts and "unexpected token [count]"
query conflicts and "unexpected token [count]" [message #493254] Fri, 23 October 2009 23:03 Go to next message
Dirk  is currently offline Dirk Friend
Messages: 4
Registered: October 2009
Junior Member
Hello,

we are trying to migrate from toplink to eclipselink.
But there are some problems getting things to work.

The first exception is:

Cannot add a query whose types conflict with an existing query.
Query To Be Added:
[ReadAllQuery(name="university.findById" referenceClass=University jpql="SELECT uni FROM University uni WHERE uni.id = :id")] is named: [university.findById] with arguments [[long]].
The existing conflicting query:
[ReadAllQuery(name="university.findById" referenceClass=University jpql="SELECT uni FROM University uni WHERE uni.id = :id")] is named: [university.findById] with arguments: [[long]].


As you can see, two times the same query. But its existing only once (I've checked this a couple of times).
The curious is, that this exception goes away after a lot of glassfish restarts and redeploys (and minor code changes, like variable renaming... !!!??)
But a view deploys later it comes back.

The second problem (after the first is solved).
We have a lot of named queries for getting row counts, like:
@NamedQuery(name = "gbEntry.countByUser", query = "select count(entry) from GuestbookEntry entry where entry.owner = :user")

EclipseLink says:
Syntax error parsing the query [gbEntry.countByUser: select count(entry) from GuestbookEntry as entry where entry.owner = :user], line 1, column 7: unexpected token [count].

persistence.xml properties
<property name="eclipselink.target-server" value="SunAS9"/>
<property name="eclipselink.target-database" value="PostgreSQL" />
<property name="eclipselink.logging.level" value="FINEST"/>

Hope somebody can help!
Thanks
Dirk



[Updated on: Fri, 23 October 2009 23:08]

Report message to a moderator

Re: query conflicts and "unexpected token [count]" [message #493539 is a reply to message #493254] Mon, 26 October 2009 17:35 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The first issue seems to be some kind of Glassfish redeployment issue. Does it ever occur on a freshly booted server, or only on redeployment?

The count query seems valid, and I tried the same query on the latest EclipseLink release, and it works. What version are you using? Can you try 1.2?



James : Wiki : Book : Blog : Twitter
Re: query conflicts and "unexpected token [count]" [message #493784 is a reply to message #493539] Wed, 28 October 2009 00:34 Go to previous messageGo to next message
Dirk  is currently offline Dirk Friend
Messages: 4
Registered: October 2009
Junior Member
It seems to be a problem of intellij idea, if I deply the application using the command line, I get only the second error.

I've attached a log file with only one start and deploy sequence in it.
I don't see any reasons for the exception.
Parts of the log are in german, but the most and important things are english.

Server.log

[Updated on: Wed, 28 October 2009 00:34]

Report message to a moderator

Re: query conflicts and "unexpected token [count]" [message #494220 is a reply to message #493254] Thu, 29 October 2009 15:56 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I can't recreate the error. Can you try other count queries and see if they work?

Perhaps try,

select count(entry.id) from GuestbookEntry entry



James : Wiki : Book : Blog : Twitter
Previous Topic:Equinox Weaving Problem
Next Topic:[toplink] em.merge() changes Java Identity of detached object
Goto Forum:
  


Current Time: Fri Nov 28 20:48:18 GMT 2014

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

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