-1

I have looked at all the similiar posts but i just cannot figure it out. Any ideas ? Here is my Main:

enter image description here

The Entity itself:

enter image description here

and finally my persistence.xml which is located inside META-INF in document root.

enter image description here

Annotation processing is turned on inside IntelliJ Idea(Ultimate 2020.2)..

Finally my build.gradle:

enter image description here

When i start the application however i get this error:

enter image description here

There is 1 entry in my database which i inserted manually. It should print out this element. Any help is greatly appreciated :(

MajesticOl
  • 311
  • 1
  • 20

1 Answers1

1

Put the NamedQuery annotation inside a NamedQueries annotation like so

@NamedQueries({
    @NamedQuery(...)
})

This works for me.

coladict
  • 4,799
  • 1
  • 16
  • 27
  • It didnt work for me... but thank you still !! – MajesticOl Nov 25 '20 at 12:58
  • @MajesticOl maybe the entity class isn't scanned at all. Try listing it manually in the `persistence.xml` just before the `exclude-unlisted-classes` tag. If that works, then it's a classloading problem and your best solution is to just keep listing the new ones you add in the xml. – coladict Nov 25 '20 at 16:12
  • This worked man ! Thanks a thousand times ! Is this a common problem ? Does this even have to do with my settings or is it more of an IDEA thing ? I want to avoid manually adding classes of thats somehow possible.... Still this works for now !Thanks a lot – MajesticOl Nov 25 '20 at 16:56
  • It's not your IDE at fault. I use Netbeans and had the same thing happen when doing a Spring project for the first time last week. I could analyze the classpath scan to learn more, but it won't change the solution. – coladict Nov 26 '20 at 06:01