0
When I run the project, my tables do not appear in the database. I noticed that when I take my relations out of the attributes that I declared @Onetomany, it creates the tables, but my project needs those relationships and the other classes are related right by the project. When I put and run the project, it doesn’t create again, is it some spring bug? Obs: no error appears in the log and the annotations are all right.
My class
@NoArgsConstructor
@AllArgsConstructor
@Data @Entity(name = "tb_user")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(length = 75, nullable = false)
private String name;
@Column(length = 75, nullable = false, unique = true)
private String email;
@Column(length = 100, nullable = false)
private String password;
@Column(length = 40, nullable = false)
@Enumerated(EnumType.STRING)
private Role role;
@OneToMany(mappedBy = "user")
private List<Request> requests = new ArrayList<Request>();
@OneToMany(mappedBy = "user")
private List<RequestStage> requestStages = new ArrayList<RequestStage>(); }
My dependencies
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
My application.properties
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3307/db_springteste?useTimezone=true&serverTimezone=UTC
spring.datasource.username=ddsinfo
spring.datasource.password=dds21231