When migrating from Spring Boot 2 to Spring Boot 3, one might face this error:
The import javax.persistence cannot be resolvedJava(268435846)
This is due to this Transition from Java EE to Jakarta EE
Spring Boot 2.x using Java EE APIs javax.*
java: package javax.persistence does not exist
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
To fix this, we can just update all javax to jakarta.
Spring Boot 3 using Jakarta EE APIs jakarta.*
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
Thanks!
Top comments (1)
hey thats helpful!