Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink issue in WLS 12c JPQL query compilation issue: can't be resolved to a valid type
EclipseLink issue in WLS 12c JPQL query compilation issue: can't be resolved to a valid type [message #1708760] Sun, 20 September 2015 15:04 Go to next message
François Courtault is currently offline François CourtaultFriend
Messages: 7
Registered: March 2014
Junior Member
Hello,

We migrate some of our solution from 10.3.6 (EclipseLink 2.3.1) to 12.1.3 (EclipseLink 2.5.2) and we got an issue:

an exception occurred while executing method
javax.persistence.PersistenceException: Exception [EclipseLink-28013] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Unable to deploy PersistenceUnit [XXX] in invalid state [DeployFailed].
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Deployment of PersistenceUnit [XXX] failed. Close all factories for this PersistenceUnit.
Internal Exception: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling ... (A select with an order by myentity.id at the end)
[224, 236] The state field path 'myentity.id;' cannot be resolved to a valid type.

The field id in my entity is declared like this:
@Id
@SequenceGenerator(name = "mySequence", sequenceName = "SEQ_ID", initialValue = 1, allocationSize = 50)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "mySequence")
@Column(name = "N_ID")
protected Long id;

So what's going wrong between these 2 EclipseLink versions ? a regression because I haven't this issue with WLS 10.3.6 (eg EclipseLink 2.3.1) ?

Best Regards.
Re: EclipseLink issue in WLS 12c JPQL query compilation issue: can't be resolved to a valid type [message #1708794 is a reply to message #1708760] Mon, 21 September 2015 09:38 Go to previous messageGo to next message
Tomas Kraus is currently offline Tomas KrausFriend
Messages: 9
Registered: November 2014
Junior Member
Could you please provide more informstion about entity (class level annotations) and PU xml?
Re: EclipseLink issue in WLS 12c JPQL query compilation issue: can't be resolved to a valid type [message #1708799 is a reply to message #1708794] Mon, 21 September 2015 10:47 Go to previous messageGo to next message
François Courtault is currently offline François CourtaultFriend
Messages: 7
Registered: March 2014
Junior Member
Hello,

For sure I can:


    Annotation at class level:

@Entity
@Table(name = "MY_ENTITY")
@NamedQueries({
@NamedQuery(name = XXX, query = "SELECT myentity "
+ "FROM MyEntity AS myentity WHERE ...."),
....
@NamedQuery(name = YYY, query = "SELECT myentity "
+ "FROM MyEntity AS myentity WHERE ....") })
@NamedNativeQuery(name = "ZZZ", query = "SELECT SEQ_XXX_ID.NEXTVAL FROM DUAL")
public class MyEntity implements Serializable {
...
}

The issue of the named query is located before the last NamedQuery in the NamedQueries list. You have to know that I have other NamedQuery where the clause myentity.id in ORDER_BY is at the end.


    PU xml:

<persistence-unit name="XXXPU"
transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>mycompagny_xa_failover.ds</jta-data-source>
<class>com.mycompagny.sss.ttt.model.MyEntity</class>

<properties>
<!-- No schema generation -->
<property name="eclipselink.ddl-generation" value="NONE" />
<property name="eclipselink.orm.validate.schema" value="true" />

<!-- Target -->
<property name="eclipselink.target-server" value="WebLogic_10" />
<property name="eclipselink.target-database" value="Oracle10g" />

<!-- logging option -->
<property name="eclipselink.logging.level" value="WARNING" />
<property name="eclipselink.logging.timestamp" value="true" />
<property name="eclipselink.logging.session" value="true" />
<property name="eclipselink.logging.thread" value="true" />
<property name="eclipselink.logging.exceptions" value="true" />
<property name="eclipselink.logging.logger" value="ServerLogger" />
<property name="eclipselink.logging.file" value="eclipselink.log" />

<property name="eclipselink.orm.throw.exceptions" value="true" />


<!-- Optimization -->
<property name="eclipselink.jdbc.native-sql" value="true" />
<property name="eclipselink.jdbc.batch-writing" value="JDBC" />

<property name="eclipselink.jdbc.fetch-size" value="25" />

<!-- <property name="eclipselink.profiler" value="PerformanceProfiler" /> -->

<!-- Cache -->
<property name="eclipselink.cache.shared.default" value="true" />
<property name="eclipselink.cache.shared.MyEntity" value="false" />
</properties>
</persistence-unit>

Best Regards.
Re: EclipseLink issue in WLS 12c JPQL query compilation issue: can't be resolved to a valid type [message #1708800 is a reply to message #1708799] Mon, 21 September 2015 10:49 Go to previous messageGo to next message
François Courtault is currently offline François CourtaultFriend
Messages: 7
Registered: March 2014
Junior Member
Hello,

Don't forget that with the same source code I have no issue with EclipselInk 2.3.1 !

Best Regards.
Re: EclipseLink issue in WLS 12c JPQL query compilation issue: can't be resolved to a valid type [message #1709874 is a reply to message #1708760] Thu, 01 October 2015 16:04 Go to previous message
François Courtault is currently offline François CourtaultFriend
Messages: 7
Registered: March 2014
Junior Member
Hello,

I have found the issue we have. In one of our NamedQuery, the query ends with a ;
After removing the ; it works fine.

The issue was that EclipseLink 2.3.1 doesn't detect this issue that why it worked on 10.3.6.

EclipseLink 2.5.2 is more strict when parsing the NamedQuery so that if it finds a ; at the end, it raises the exception with
[224, 236] The state field path 'myentity.id;' cannot be resolved to a valid type.

Best Regards.
Previous Topic:NoSQL|Mongo : How to use ObjectID ?
Next Topic:Add custom generator re-using table generator
Goto Forum:
  


Current Time: Tue Mar 02 15:14:28 GMT 2021

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

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

Back to the top