I'm using JPA (EclipseLink 2.4.1) with a mapping-file containing named-queries. Eclipse shows me the following warning message in my mapping file:
No mapping is associated with the state field path 't.progress'.
The warning is of the type JPA Problem
. The corresponding lines in my named-queries.xml
-file look like this:
<named-query name="FinishedTasks">
<query><![CDATA[SELECT t FROM Task t WHERE t.progress = 100]]></query>
</named-query>
However, the query runs fine when executed, so no warning in run-time.
Here's what the file Task.java
looks like (excerpt):
@Entity
public class Task extends Issue {
private Integer progress = 0;
public Integer getProgress() {
return progress;
}
public void setProgress(final Integer progress) {
this.progress = progress;
}
}
Issue.java
looks like this (excerpt):
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public class Issue implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
public long getId() {
return id;
}
public void setId(final long id) {
this.id = id;
}
}
I have no warnings about queries using Issue.
So my question is, how do I get rid of the warning? And does the warning have some implication I'm not aware of (as said, the query runs fine).
No mapping is associated with the state field path 't.progress'
I believe this is totally due to the Eclipse JPA Details View (orm.xml
editor) and has nothing to do with EclipseLink nor JPA in general. The warning is reminding you that the Named Query is using a JPA query path (t.progress
) that is not mapped in the mapping file. The View / xml editor is not analysing the metadata of your java classes, so is not aware whether the it is mapped via JPA annotations.
i.e. the tool is doing the best job for you it possibly can give it's technology / scope limitations.
Solution:
:^)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With