Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dali » validation error
validation error [message #729089] Sun, 25 September 2011 02:34 Go to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Hi,

I just upgraded from Eclipse w/ WTP 3.6.2 to 3.7.1 (Dali 3.0.1), and it
appears Dali's validation is stricter or perhaps has a bug. I got no
errors with 3.6.2, but now I'm getting:

The identification variable 'mil' is not defined in the FROM clause. orm.xml

and this is:
w.approvalStatus = mil.army.usace.p2.constants.ApprovalStatus.PENDING

in the context of:
<named-query name="workflowProcess">
<query>
SELECT w
FROM WorkflowProcess w
WHERE w.projectId = :projId
AND w.processTypeWorkflowStatusId = :statusId
AND w.approvalStatus =
mil.army.usace.p2.constants.ApprovalStatus.PENDING
AND w.workflowCycleCount = :count
</query>
</named-query>

Can anyone tell me why it's mistaking that package name for an
identification variable? Do I need to make some change now?

Thanks,
Ari
Re: validation error [message #729659 is a reply to message #729089] Mon, 26 September 2011 17:45 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Ari,

It seems that you have found a bug in our new JPQL validation functionality[1]. We are not correctly validating the enum literal in this case.

As a workaround you can turn off/modify the JPQL validation in Preferences->JavaPersistence->JPA->Errors/Warnings->Queries and Generators-> Invalid or incomplete JPQL queries - Ignore.

We are logging a bug for this, which will be fixed in Indigo SR2. Thanks for bringing this to our attention.

Neil

[1] - http://eclipse.org/webtools/releases/3.3.0/NewAndNoteworthy/jpt.php
Re: validation error [message #729720 is a reply to message #729659] Mon, 26 September 2011 19:50 Go to previous messageGo to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Thanks for confirming, Neil. Another validation error I'm getting is:

Duplicate converter "booleanConverter" defined in this persistence unit

for:
@Column(name="SND_CEFMS_FLAG")
@Converter(
name="booleanConverter",
converterClass=mil.army.usace.p2.entity.converter.BooleanConverter.class)
@Convert("booleanConverter")
private boolean sendToCefms;

I do have many such annotations across my entities with the same name
"booleanConverter". Is this considered invalid now? Obviously I could
make each name unique to get around this, but is there a way to define
the reference globally using an annotation, or do I need remove these
annotations and use eclipselink-orm.xml?

Thanks again,
Ari

On 9/26/2011 12:45 PM, Neil Hauge wrote:
> Ari,
>
> It seems that you have found a bug in our new JPQL validation
> functionality[1]. We are not correctly validating the enum literal in
> this case.
> As a workaround you can turn off/modify the JPQL validation in
> Preferences->JavaPersistence->JPA->Errors/Warnings->Queries and
> Generators-> Invalid or incomplete JPQL queries - Ignore.
>
> We are logging a bug for this, which will be fixed in Indigo SR2. Thanks
> for bringing this to our attention.
>
> Neil
>
> [1] - http://eclipse.org/webtools/releases/3.3.0/NewAndNoteworthy/jpt.php
Re: validation error [message #731324 is a reply to message #729720] Fri, 30 September 2011 16:10 Go to previous messageGo to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Neil? Anyone?
Re: validation error [message #731398 is a reply to message #729720] Fri, 30 September 2011 20:29 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Ari Meyer wrote on Mon, 26 September 2011 15:50


I do have many such annotations across my entities with the same name
"booleanConverter". Is this considered invalid now? Obviously I could
make each name unique to get around this, but is there a way to define
the reference globally using an annotation, or do I need remove these
annotations and use eclipselink-orm.xml?



Sorry I missed your previous post.

The fact that we are using an Error for this condition is probably overkill, but the reason it is being flagged is that all converters are global, regardless of where they are defined. So, you can define it once in an entity and reference it in other entities. You could also define the converter in a mapping file as you mentioned, which is considered a better solution as it is awkward to have a global defined in a Java entity. At the end of the day though, it is up to you where you want to define it, as it will be a global definition regardless of where it is defined.

Neil
Re: validation error [message #731399 is a reply to message #731398] Fri, 30 September 2011 20:32 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Also, regarding the first query related issue, the following bug was entered, and will be fixed in the next service update (Indigo SR2).

https://bugs.eclipse.org/bugs/show_bug.cgi?id=358957

Neil
Re: validation error [message #731405 is a reply to message #731398] Fri, 30 September 2011 21:00 Go to previous messageGo to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Thanks for the info, Neil -- will make the change.
Ari
Re: validation error [message #731881 is a reply to message #731398] Mon, 03 October 2011 11:46 Go to previous messageGo to next message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
It appears that EclipseLink only gives an error for converters being named the same if they are actually different. I tested around a little and was able to get an EclipseLink exception if I pointed to a different converter class. We should add this extra check to our validation to make it less strict. I entered bug 359690

Exception Description: Conflicting annotations with the same name [booleanConverter] were found. The first one [@org.eclipse.persistence.annotations.Converter({name=booleanConverter, converterClass=mil.army.usace.p2.entity.converter.BooleanConverter})] was found within [field fooBar] and the second [@org.eclipse.persistence.annotations.Converter({name=booleanConverter, converterClass=mil.army.usace.p2.entity.converter.FooConverter})] was found within [field sendToCefms]. Named annotations must be unique across the persistence unit.
Re: validation error [message #767059 is a reply to message #729659] Fri, 16 December 2011 23:53 Go to previous messageGo to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Hi Neil,

Another validation error I got was: "The left parenthesis is missing
from the IN expression." So I added parens to the IN expression.

old:
SELECT SUM(btr.budgetAmt)
FROM BudgetTaskrsrc btr
WHERE btr.projectId = :projectId
AND btr.budgetType = :budgetType
AND btr.rsrcId IN :resourceIds
GROUP BY btr.projectId

new:
SELECT SUM(btr.budgetAmt)
FROM BudgetTaskrsrc btr
WHERE btr.projectId = :projectId
AND btr.budgetType = :budgetType
AND btr.rsrcId IN (:resourceIds)
GROUP BY btr.projectId

Voila -- validation error goes away. Only problem is that it fails to
execute:

java.lang.IllegalArgumentException: You have attempted to set a value of
type class java.util.ArrayList for parameter resourceIds with expected
type of class java.lang.Long from query string
SELECT SUM(btr.budgetAmt)
FROM BudgetTaskrsrc btr
WHERE btr.projectId = :projectId
AND btr.budgetType = :budgetType
AND btr.rsrcId IN (:resourceIds)
GROUP BY btr.projectId

If I then remove the parens, no error.

We're running Eclipselink 2.1.3 on jdk 1.6.0_18 (and WebLogic 10.3.1).
Using Eclipse w/ WTP 3.7.1 (Dali 3.0.1).

Do I need to report this to the Eclipselink folks?

Thanks,
Ari
Re: validation error [message #768217 is a reply to message #767059] Mon, 19 December 2011 19:16 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Ari,

This looks more like a Dali problem. Please file a bug against Dali and if it turns out it is an EclipseLink issue we can follow up with them. We will fix this issue for the Indigo SR2 release. Thanks for reporting.

Neil
Re: validation error [message #768304 is a reply to message #768217] Mon, 19 December 2011 22:05 Go to previous messageGo to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Thanks Neil -- will do!
Re: validation error [message #832251 is a reply to message #768217] Fri, 30 March 2012 00:09 Go to previous messageGo to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Hi Neil,

Sincere apologies -- I forgot to file this after having problems logging
into the Eclipse site (only remembered to do this after seeing the
problem again with a new installation). The bug is
https://bugs.eclipse.org/bugs/show_bug.cgi?id=375676 .

Best regards,
Ari
Re: validation error [message #863276 is a reply to message #729659] Sun, 29 April 2012 11:11 Go to previous messageGo to next message
Karsten Wutzke is currently offline Karsten WutzkeFriend
Messages: 124
Registered: July 2009
Senior Member
Hello,

has this really been fixed? I'm getting

index.php/fa/8137/0/

on
    <query>
      SELECT pq
        FROM Prequalification pq
        JOIN FETCH pq.user us
        JOIN FETCH us.person pe
        LEFT JOIN FETCH pq.tendering te
        LEFT JOIN FETCH te.customer cu
        LEFT JOIN FETCH cu.postAddresses pa
      WHERE pq.id = :pqId
      GROUP BY pq.id
    </query>


and I've performed a full Eclipse software update recently (2012-04).

Is this a bug? (if so, the error message also needs to be fixed: "... must be provideR ...")

Karsten
Re: validation error [message #865865 is a reply to message #863276] Mon, 30 April 2012 16:09 Go to previous messageGo to next message
Karsten Wutzke is currently offline Karsten WutzkeFriend
Messages: 124
Registered: July 2009
Senior Member
Ermm anyone?
Re: validation error [message #866419 is a reply to message #729089] Mon, 30 April 2012 22:02 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
The previously mentioned issues on this thread have been fixed in the most recent service release, but your case appears to be unrelated to those.

At a glance, it would appear your query is not valid JPQL, and this would result in the errors you are seeing.

From the JPA 2.0 spec:

"The syntax for a fetch join is

fetch_join ::= [ LEFT [OUTER] | INNER ] JOIN FETCH join_association_path_expression

The association referenced by the right side of the FETCH JOIN clause must be an association or element collection that is referenced from an entity or embeddable that is returned as a result of the query. It is not permitted to specify an identification variable for the objects referenced by the right side of the FETCH JOIN clause, and hence references to the implicitly fetched entities or elements cannot appear elsewhere in the query."


Neil
Re: validation error [message #867554 is a reply to message #866419] Tue, 01 May 2012 10:59 Go to previous messageGo to next message
Karsten Wutzke is currently offline Karsten WutzkeFriend
Messages: 124
Registered: July 2009
Senior Member
I'm pretty sure the JPQL is correct, also the statement simply works, returning the entities as expected.

I'm not sure what an identification variable is, but all JOIN FETCH expressions to the right are regular @XToX relationships to entities, the code for the entities was/is generated and is pretty much tested AND working.

I have just reverted to showing an ERROR on invalid JPQL, strangely the errors I couldn't get rid of originally now don't appear at all. Confused

Karsten
Re: validation error [message #867849 is a reply to message #867554] Tue, 01 May 2012 14:10 Go to previous messageGo to next message
Neil Hauge is currently offline Neil HaugeFriend
Messages: 475
Registered: July 2009
Senior Member
Some JPA providers may go beyond the spec and provide support for these variable declarations. The JPQL validation in Dali is extensible, so depending on what type of JPA Platform you are using, you probably want to contact that provider and file a bug so they can customize this validation for their implementation of the spec.

Turning down the JPQL validation is what I would recommend, as you have suggested, until this issue can be fixed by your platform provider.

Neil
Re: validation error [message #868234 is a reply to message #867554] Tue, 01 May 2012 18:08 Go to previous messageGo to next message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
Karsten Wutzke wrote on Tue, 01 May 2012 06:59


I have just reverted to showing an ERROR on invalid JPQL, strangely the errors I couldn't get rid of originally now don't appear at all. Confused

Karsten


I think you're seeing bug 374379 which was just fixed pretty recently in Juno. I was under the impression this doesn't exist in Indigo. What version are you using?

Karen
Re: validation error [message #868914 is a reply to message #868234] Wed, 02 May 2012 18:23 Go to previous messageGo to next message
Karsten Wutzke is currently offline Karsten WutzkeFriend
Messages: 124
Registered: July 2009
Senior Member
Indigo.

Karsten
Re: validation error [message #869512 is a reply to message #868914] Thu, 03 May 2012 14:02 Go to previous messageGo to next message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
I have entered bug 378373 so we can fix this in Indigo 3.0.3
Re: validation error [message #869926 is a reply to message #869512] Fri, 04 May 2012 20:20 Go to previous messageGo to next message
Karsten Wutzke is currently offline Karsten WutzkeFriend
Messages: 124
Registered: July 2009
Senior Member
Thanks for this. Upvoted. As well as your name +1 strangely similar Smile
Re: validation error [message #870270 is a reply to message #869926] Mon, 07 May 2012 14:30 Go to previous message
Karen Butzke is currently offline Karen ButzkeFriend
Messages: 220
Registered: July 2009
Senior Member
I was thinking the same thing, I married in to my German last name Smile
Previous Topic:Table Generation from Entities with Embeddable Inheritance
Next Topic:Tool to run JPQL queries on the fly
Goto Forum:
  


Current Time: Tue Mar 19 08:23:44 GMT 2024

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

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

Back to the top