I'm very new to Java, SpringBoot, and MySQL..I'm still in class, so none of this is making any sense to me. I haven't tried anything, because I wouldn't even know where to start. I thought I had all the right dependencies, but when I highlight over the red problem light bulb in my Event.java it just says 'Find JAR on web' I did get this code directly from the book I'm reading and following alone with while watching the video for it. Any help at all would be greatly appreciated. Like I said, I am very new to this and don't understand much of the lingo just yet Photo of the dependencies Photo of the code and trying import
-
Does this answer your question? [The import javax.persistence cannot be resolved](https://stackoverflow.com/questions/15598210/the-import-javax-persistence-cannot-be-resolved) – Stephen C Aug 13 '23 at 12:55
4 Answers
From springboot 3 you need to replace in the imports of the class
import javax.persistence.*
with
import jakarta.persistence.*;

- 71
- 4
-
This. I’m also a super new spring boot dev following guides on Spring.io. For some reason they haven’t updated the documentation yet – Razorshnegax018 Aug 10 '23 at 19:48
I think your dependencies are correct You added already spring-boot-starter-data-jpa So you may need refresh dependencies then clean and build your project

- 44
- 4
I'm sure this is too late for OP but for the future, I think I'm going through the same bootcamp and encounter the exact same error. I was able to resolve by invalidating the caches and restarting IntelliJ (File -> Invalidate caches). Once it redownloaded the dependencies, it was able to find the import.
Here's a thread with more details on this: How to clean project cache in IntelliJ IDEA like Eclipse's clean?

- 35
- 5
You would have missed this dependency- Spring data JPA This one is for Maven projects. Also, please note if you have copy pasted code from older versions then you might be importing the annotation using javax but it has been changed to jakarta.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
add this one in your POM under the dependencies section and then use ctrl+click on @Entity to import it from.
Earlier it was like this:
import javax.persistence.Entity;
and then changed to:
import jakarta.persistence.Entity;

- 1
- 1