Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357975

Summary: Invalid JPQL error if named-query is in orm.xml
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: JPAAssignee: Pascal Filion <pascal.filion>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jolene.moffitt, neil.hauge
Version: 3.0   
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix the issue related to orm.xml
none
Fix for bug none

Description Karen Butzke CLA 2011-09-16 14:26:59 EDT
I get the validation error "The abstract schema type 'Employee' is unknown" given the following orm.xml entity.

<entity class="model.Employee">
	<named-query name="select">
		<query>SELECT x FROM Employee x</query>
	</named-query>
</entity>

If I add the model.Employee class to the persistence.xml, the error disappears. It should not need to be listed in the persistence.xml.
Comment 1 Pascal Filion CLA 2011-09-27 19:27:42 EDT
Created attachment 204129 [details]
Fix the issue related to orm.xml

The external form used by Hermes was not created correctly, there is no need to make a difference between pu and orm.
Comment 2 Pascal Filion CLA 2011-09-28 16:24:42 EDT
Created attachment 204222 [details]
Fix for bug
Comment 3 Neil Hauge CLA 2011-09-30 11:43:06 EDT
The validation/content assist functionality is working nicely in this patch.  The only issue I am seeing (which may be unrelated to the patch) is an exception when backspacing at the following location in the Details view on an Named Query in an ORM XML Entity:

Select o from Owner o JOIN o.pets[cursor]

I get:

java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key COLLECTION_VALUED_PATH_EXPRESSION_NOT_RESOLVABLE
    at java.util.ResourceBundle.getObject(ResourceBundle.java:374)
    at java.util.ResourceBundle.getString(ResourceBundle.java:334)
    at org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlContentProposalProvider.buildMessage(JpaJpqlContentProposalProvider.java:322)
    at org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlContentProposalProvider.validate(JpaJpqlContentProposalProvider.java:584)
    at org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlContentProposalProvider.access$10(JpaJpqlContentProposalProvider.java:567)
    at org.eclipse.jpt.jpa.ui.internal.jpql.JpaJpqlContentProposalProvider$6.modifyText(JpaJpqlContentProposalProvider.java:330)
Comment 4 Neil Hauge CLA 2011-09-30 14:17:11 EDT
Regarding the issue encountered in comment #3, I have open a separate bug 359585.  That issue will be addressed separately as it is not related to this patch.
Comment 5 Pascal Filion CLA 2011-09-30 14:23:43 EDT
Checked in the fix into CVS.
Comment 6 Jolene Moffitt CLA 2011-10-18 11:50:26 EDT
Verified in Build I-3.4.0-20111013215153 

Verified the abstract error does not appear when you add the query.  See the link to view test steps for verification.
http://wiki.eclipse.org/Dali_3.1_M3