Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsJPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900117/#msg_900117
I have a named-queries.xml file with the following simple query:
<named-query name="IndividualDocument.forTypes">
<query>
SELECT id
FROM IndividualDocument id
JOIN FETCH id.company co
LEFT JOIN FETCH id.documentType dt
WHERE dt IS NULL OR dt IN :docTypes
ORDER BY id.fileName
</query>
</named-query>
There are several errors in the XML editor:
Multiple annotations found at this line:
- The abstract schema type 'co' is unknown.
- The FROM clause has 'IndividualDocument id JOIN FETCH id.company' and 'co LEFT JOIN FETCH
id.documentType' that are not separated by a comma.
- An identification variable must be provider for a range variable declaration.
Multiple annotations found at this line:
- The abstract schema type 'dt' is unknown.
- The FROM clause has 'co LEFT JOIN FETCH id.documentType' and 'dt ' that are not separated by a
comma.
- An identification variable must be provider for a range variable declaration.
Multiple annotations found at this line:
- The identification variable 'dt' is not defined in the FROM clause.
- The IN expression does not have a valid state field path expression or TYPE expession.
- The left parenthesis is missing from the IN expression.
The above query is just an example. The file is full of validation errors:
Everything is working fine with Hibernate as JPA provider, so I assume this one and other queries to be correct. There are no problems with the mappings (code is generated, assume this as working).
However, this doesn't do ANYTHING... I cleaned and re-built the project several times - nothing. Errors still there.
How do you *globally* turn off this whole Dali validation stuff? It would suffice to turn off all JPQL/named-queries.xml validation somewhere.
I even upgraded to the latest Indigo release some minutes ago (full reinstall). Still stuck.
Sorry for the rant, but these problems occurr much too frequently. It makes Dali one of the most annoying (not to say useless) Eclipse tools overall.
Anyway, how do you solve this? I can't do anything useful with the project as long as the errors prevail.
Thanks
Karsten
]]>Karsten Wutzke2012-08-04T08:00:20-00:00Re: JPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900173/#msg_900173
1. the FETCH keyword causes the errors on each JOIN line
2. the parentheses around a collection used as query parameter
3. the plain entity from the FROM clause before an IN ... isn't allowed, you have to use a field from the entity
For 1., this breaks application code - no acceptable workaround.
For 3., it appears as if Dali doesn't validate just the entity reference itself before the IN operator, but instead expects a "state field expression". It works when using co.name IN (...) and dt.label IN (...), but the (..) are collections of entities passed (like List<Company> not company names or IDs).
Currently looks like 3 bugs in one statement... YUCK
Could this be true? At least 1. and 2. are obviously Dali problems.
Can anyone from the developers confirm this pleasE?
Karsten
PS: I have no idea why Dali still shows validation errors on named-queries.xml even when all options are set to "Ignore".
]]>Karsten Wutzke2012-08-05T02:32:04-00:00Re: JPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900363/#msg_900363
Sorry you are running into problems with the JPQL validation. We should have some answers for these issues shortly. There is a way to turn off automatic JPA validation in Eclipse. In the workspace preferences or project properties select the Validation tab. Here you can disable JPA Validation in whole, or you can go click the settings button and turn off validation specifically for ORM Mapping files (content type).
Neil]]>Neil Hauge2012-08-06T15:54:46-00:00Re: JPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900394/#msg_900394
thanks for answering. Switching off the validation for XML files works. It would be nice to use Dali validation in the future though.
I'm curious to know about the issues I had, whether this is valid JPA or bugs found.
Karsten]]>Karsten Wutzke2012-08-06T20:38:11-00:00Re: JPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900396/#msg_900396
http://www.eclipse.org/forums/index.php/t/369041/ ]]>Karsten Wutzke2012-08-06T20:39:38-00:00Re: JPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900408/#msg_900408
The JPA spec does not allow a JOIN FETCH to be identified with an identification variable. JPQL validation is based on the platform set in the project properties (project properties->JPA->Platform combo).
If the platform is set to Generic, then JPQL validation will use the JPQL grammar defined in the corresponding spec. I am not sure if Hibernate added JPQL validation support. You might want to double check with them and maybe request for the support. EclipseLink 2.4 added support for identifying a JOIN FETCH and validation will indeed validate it correctly.
3: Plain entity from the FROM clause before an IN
The JPA spec does not allow using an identification variable before the IN expression, only a state field path expression or the TYPE expression:
I do not know if Hibernate supports it.]]>Pascal Filion2012-08-06T21:40:26-00:00Re: JPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900465/#msg_900465
1. A JOIN FETCH cannot be qualified? Hmmm, this looks like a bug in the JPA spec if you ask me.
2. I'll re-check this.
3. Pure disappointment. I had expected to use entity relationships to see if a company is in the set/list of associated companies and the like. Strange.
Thanks for clearing things up a little.
Karsten]]>Karsten Wutzke2012-08-07T08:17:30-00:00Re: JPQL validation errors in named-queries.xml not ignored
https://www.eclipse.org/forums/index.php/mv/msg/369011/900581/#msg_900581
http://java.net/projects/jpa-spec .