Reputation: 29
This is the first time I am going to create an application using java 17 and Spring boot 3.2.7. In no way spring boot is able to create tables and columns in mysql schema after starting my application.
This is my User Class
import java.time.LocalDateTime;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Entity
@Table(name = "User")
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String name;
private String email;
private String password;
@Transient
private String confirmPassword;
private String ipAddress;
private LocalDateTime sessionStarted;
private LocalDateTime sessionClosed;
}
This is my application properties
This is my repository Interface
import org.springframework.data.jpa.repository.JpaRepository;
import entity.User;
public interface UserRepository extends JpaRepository<User, Long>{
}
This is the console
I want to crate those columns with spring Data JPA, but it's not working. Where are my faults?
Upvotes: 0
Views: 311
Reputation: 29
I found the solution. This is the first time I am doing it using STS/Eclipse IDE. I created all the packages under src/main/java.
*** What I must do is creating packages under the main application class, for example, create all the packages under com.crud.example where main class resides, not under src/main/java ***
Upvotes: 0