0

this is my person.java

package com.example.bootdemoapp.entities;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor

// Class
public class Person {
    @Id
    private Integer personId;
    private String personName;
    private String personCity;
}

this is my build.gradle

plugins

{
id 'java'
id 'org.springframework.boot' version '3.1.2'
id 'io.spring.dependency-management' version '1.1.2'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
useJUnitPlatform()
}

followed all the below step and facing error

1.Refresh Gradle Project:

Go to the Gradle tool window on the right side of IntelliJ IDEA (if not visible, you can open it via "View" > "Tool Windows" > "Gradle"). Click on the "Refresh" button to refresh your Gradle project and ensure all dependencies are correctly downloaded. 2.Check for Errors in Event Log:

Look for any error messages or notifications in the Event Log at the bottom of the IntelliJ IDEA window. It may provide additional information about what might be causing the issue.

3.Ensure Java SDK is Set:

Verify that you have set the correct Java SDK for your project. Go to "File" > "Project Structure" > "Project Settings" > "Project" and ensure that the correct JDK is selected.

4.Invalidate Caches and Restart IntelliJ IDEA:

Go to "File" > "Invalidate Caches / Restart" and select "Invalidate and Restart." This will clear IntelliJ IDEA's caches and restart the IDE

I have tried to execute the below command

gradlew.bat clean build
  • 1
    If you're using Spring Boot 3.1.2, then you should be using the `jakarta.persistence` package, not `javax.persistence`. – Mark Rotteveel Aug 13 '23 at 11:22
  • @MarkRotteveel - In the duplink you used, the OP was using links to images to explain the problem. I found a better one. With a better answer. – Stephen C Aug 13 '23 at 12:57

0 Answers0