JPA annotations and Interfaces [closed]
Question
I have a class Animal and an interface it inherits from IAnimal.
@MappedSuperclass
public class Animal implements Serializable, IAnimal{...}.
@Entity
public class Jaguar extends Animal{...}
My first question is, do I need to annotate the interface?
I asked this because I am getting this error when I run my tests:
Error compiling the query [SELECT s FROM animal s WHERE s.atype = :atype]. Unknown abstract schema type [animal]
If I remember correctly, before I added this interface it was working.
Solution
This error is occurring because you spelled Animal with a common a in the query. Try this:
SELECT s FROM Animal s WHERE s.atype = :atype
OTHER TIPS
Does
SELECT s FROM Animal s WHERE s.atype = :atype
work? (just changed the case of animal)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow