I try to declare NamedQuery in the mapped superclass, but I get this error:
org.hibernate.hql.ast.QuerySyntaxException: VoipCall is not displayed [select v from VoipCall v, where v.audioFile =: audioFile]
We use sleep mode, but we prefer to use standard JPA notation.
Here is the code:
@MappedSuperclass
@NamedQueries(value = {
@NamedQuery(name = "getVoipCallsForAudio", query = "select v from VoipCall v where v.audioFile = :audioFile")
})
public abstract class VoipCall implements Serializable {
It seems that I cannot use my mappedSuperClass in the request, but I do not understand why, if in the JPA API I found this:
NamedQuery annotation can be applied to an entity or associated superclass.
Where am I mistaken?
Thanks!!
SOLUTION:
The solution for me was a workaround: I moved the named query to subclasses by changing the where clause. This, from my point of view, gives me less code support, but I cannot do otherwise.