JPA validation error on JPQL long state field path [message #819352] |
Mon, 12 March 2012 16:19  |
Eclipse User |
|
|
|
I am getting the following JPA validation error on a JPQL named query -- that successfully compiles and runs with Hibernate as the JPA provider. I am just trying to understand if the problem is in my code (and I got lucky) or if the problem is in the JPA validation feature around state fields, or both.
The error is this:
"The state field path 'cl.namespace.id' cannot be resolved to a valid type."
It stems from the following named query on the class "cal".
@Entity
@Access(AccessType.PROPERTY)
@Table(name = "cal")
@NamedQueries({ @NamedQuery(name = "CalImpl.findByNamespace", query = "SELECT cl FROM CalImpl cl WHERE cl.namespace.id = ?1") })
public class CalImpl {
.....
private Namespc namespace;
@Override
@ManyToOne(optional = false, targetEntity = NamespaceImpl.class, fetch = LAZY)
@JoinColumn(name = "namespace_id", nullable = false)
public Namespc getNamespace() {
return namespace;
}
public void setNamespace(final Namespc namespace) {
this.namespace = namespace;
}
Without providing the full class definitions, you can see that each CalImpl has a private field "namespace" (with getter and setter). Note that CalImpl declares the "namespace" field as an interface "Namespc". The "Namespc" interface has a "getId" property getter and the implementation class "NamespaceImpl" has a private field "id" and implements the Namespc interface.
Currently I am thinking that there is an issue with JPA validation because according to the JPA 2 spec, it should be possible to have path expressions that concatenate multiple state fields. From the spec page 127:
"Path expressions can be composed from other path
expressions if the original path expression evaluates to a single-valued type (not a collection).
In the following example, contactInfo denotes an embeddable class consisting of an address and
set of phones. Phone is an entity.
SELECT p.vendor
FROM Employee e JOIN e.contactInfo.phones p
WHERE e.contactInfo.address.zipcode = '95054'
Path expression navigability is composed using "inner join" semantics."
Also I noticed that the code completion for state fields only works for local fields and does not seem to cross over into other persistence types.
[Updated on: Mon, 12 March 2012 23:50] by Moderator
|
|
|
|
|
|
|
|
Re: JPA validation error on JPQL long state field path [message #1734397 is a reply to message #879012] |
Tue, 07 June 2016 17:46  |
Eclipse User |
|
|
|
Karen Butzke wrote on Wed, 30 May 2012 07:13bug 374145
bug 378373
Hi, just following up on issue 374145. I am running Eclipse Luna with Dali JPA Core 3.4.0v2013120521 and I am still seeing this issue (the original one about the state field path -- the other one #378373 about changing the problem to information has been fixed).
My project is JPA faceted version 2.1. Was there a regression along the way? It's the same error message on the same line(s) of code....
|
|
|
Powered by
FUDForum. Page generated in 0.06167 seconds