Estou criando uma API para treinar os ensinamentos do curso e comecei adicionando duas Models. Elas persistem no H2. Porém, quando eu adiciono mais duas models que possuem relacionamento ManyToOne e OneToMany eu obtenho esse erro na model que possui o relacionamento ManyToOne:
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "ALTER TABLE ORDER_FOLLOW_UP ADD CONSTRAINT FK4AGPPR9H0G8PGMRU475DFJD4M FOREIGN KEY (ORDER_ID) REFERENCES ORDER[*]"; expected "identifier"; SQL statement:
As models são essas:
@Entity
public class Order {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
private Responsible responsible;
private LocalDateTime createdDate = LocalDateTime.now();
@ManyToOne
private Customer customer;
private String productModel;
private String productType;
private String issue;
@Enumerated(EnumType.STRING)
private OrderStatus status = OrderStatus.REGISTERED;
@OneToMany(mappedBy = "order")
private List<OrderFollowUp> orderFollowUps = new ArrayList<>();
@Entity
public class OrderFollowUp {
@Id @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
private Order order;
private String description;
private LocalDateTime followUpDate = LocalDateTime.now();
Não sei qual o problema, pois as models que eu criei antes dessas, persistiram no H2.