Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse Indigo - Strange JPA Problems in known-good code
Eclipse Indigo - Strange JPA Problems in known-good code [message #717281] Fri, 19 August 2011 20:17 Go to next message
diego.rivera.cr is currently offline diego.rivera.crFriend
Messages: 5
Registered: January 2011
Junior Member
Hello, all!

I updated my Eclipse from Helios SR1 to Indigo a few days ago, and noticed that one of my primary projects now has a myriad of JPA problems which were obviously not showing up before. Just to be clear, the code in question is production code which builds, compiles, weaves statically (at build time, obviously) with EclipseLink 2.2.0, and runs perfectly in production.

Indigo is complaining about "the left parenthesis is missing from the IN expression", which is obviously incorrect (as per JPA 2.0 spec, the lack of such parenthesis denotes that the parameter is collection-typed), among a myriad of other apparently obvious syntax errors. The kind of syntax errors that clearly don't really exist but may be due to a "confused" parser.

These JPA problems appear to be related to changes in Indigo's parsing of JPA's @NamedQuery (and @NamedNativeQuery).

Here's a sample of the code being flagged (lines flagged have * on the left):

@NamedQuery(name = "fileItem.findLoggable", query = //
" select distinct i " + //
" from FileItem i " + //
* " where i.env = :env " + //
* " and i.state in :states " + //
* " and i.logged = false " + //
* " and i.env.enabled = true " + //
" and i.data.enabled = true " + //
" and i.owner.enabled = true " + //
" order by i.owner.id.name "),

There are other great many queries like this one in the file. Other JPA entity files have a similar set of @NamedQuery entries. We find this convenient since it groups the entity with all the queries that affect or retrieve instances.

The flagged errors are mostly "= cannot be resolved to a type" or "and cannot be resolved to a type" or the stranger still "is cannot be resolved to a type" (?!?! there's no word "is" in any of the queries!!)

Note the use of // and + to enable "pretty formatting" (albeit manual) for queries. Of importance is that I already attempted to eliminate the formatting (i.e. put it all in the same line, with single spaces, etc), to no avail.

Some details on the parameters for this particular: "env" is a JPA entity, "states" is a collection-typed set of enums (properly mapped to JPA - as I said, this code WORKS).

This is only one example, on one file. There are multiple such @NamedQuery entries on that file, and ALL of them produce problems. The fun fact is that if I remove all the @NamedQuery entries from one file, this will fix the problem but another file will then be flagged (i.e. not all files are flagged at once - seems to flag them one at a time)

Can you offer any guidance short of "turn off JPA validation"?

I can offer more specifics if needed - I just didn't want the post to be TOO long (probably too late for that Smile ).


Thanks!

UPDATE: The following query also poses a different conundrum:


" delete " + //
" from FileItem i " + //
* " where exists ( " + //
" select c " + //
* " from Calendar c " + //
" where i.calendar = c " + //
" )" + //
" and i.env = :env")

The parser complains about "identification variable 's' is not defined in the FROM clause", and "identification variable 'i' is not defined in the FROM clause" (the 's' complaint is repeated on the 2nd line, so the 2nd line actually has 2 markers - one for 's' and one for 'i').

More weirdness...

[Updated on: Fri, 19 August 2011 20:30]

Report message to a moderator

Re: Eclipse Indigo - Strange JPA Problems in known-good code [message #717608 is a reply to message #717281] Sun, 21 August 2011 17:05 Go to previous messageGo to next message
diego.rivera.cr is currently offline diego.rivera.crFriend
Messages: 5
Registered: January 2011
Junior Member
Here's a copy of the errors I get... ALL of these errors are nonsensical - the files compile properly via maven, and can be properly deployed to Glassfish 3.1

Description Resource Path Location Type
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 230 JPA Problem
'=' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 237 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 230 JPA Problem
'and' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 237 JPA Problem
'e' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
'e' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 230 JPA Problem
'e' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 237 JPA Problem
'is' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
'is' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
'not' cannot be resolved to a type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
The expression is not a valid conditional expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 207 JPA Problem
The left expression is missing from the logical expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 207 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 162 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 172 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 195 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 217 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 224 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 230 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 237 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 244 JPA Problem
The left parenthesis is missing from the IN expression. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 251 JPA Problem
The state field path 'i.env.enabled' cannot be resolved to a valid type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 67 JPA Problem
The state field path 'i.env.enabled' cannot be resolved to a valid type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 142 JPA Problem
The state field path 'i.env.enabled' cannot be resolved to a valid type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 153 JPA Problem
The state field path 'i.env.enabled' cannot be resolved to a valid type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 207 JPA Problem
The state field path 'i.owner.enabled' cannot be resolved to a valid type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 77 JPA Problem
The state field path 'i.owner.enabled' cannot be resolved to a valid type. FileItem.java /TXP/src/main/java/com/erudicity/builder/persistence/entity line 182 JPA Problem

Funny thing is - I set the JPA Errors/Warnings setting for "Invalid or incomplete JPQL queries" (Queries and Generators section) to "Warning" instead of "Error", and they all went away - they weren't even reported as warnings! If I "Restore Defaults" on that page (i.e. the setting gets put back as an error), then they all come back... So this definitely has the smell of a cockroach.

I've also tested this application with Glassfish 3.1.1 - and the application works perfectly (passes all tests), so it's definitely just Eclipse's JPA parsing.

[Updated on: Sun, 21 August 2011 17:06]

Report message to a moderator

Re: Eclipse Indigo - Strange JPA Problems in known-good code [message #750554 is a reply to message #717608] Tue, 25 October 2011 20:56 Go to previous messageGo to next message
AJ Coon is currently offline AJ CoonFriend
Messages: 1
Registered: October 2011
Junior Member
Did you ever find a resolution to this problem? I have the same type of errors.
Re: Eclipse Indigo - Strange JPA Problems in known-good code [message #804670 is a reply to message #750554] Wed, 22 February 2012 21:53 Go to previous message
David Vree is currently offline David VreeFriend
Messages: 48
Registered: July 2010
Member
I am getting these as well. Anyone have a work around?
Previous Topic:Why does printing parent node of a node returns parent + child nodes?
Next Topic:Adding jar in Deployment Assembly
Goto Forum:
  


Current Time: Thu Apr 25 03:35:58 GMT 2024

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

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

Back to the top