Java, Spring Boot: Table not found (H2-DB) when adding a new property

as a beginner in Spring Boot, I have a problem that I don’t fully understand and I hope someone in this forum can help me!? Maybe someone else has already encountered this problem?

I’ve started a new project with jpa, hibernate and a h2 db. I created two entities: one for a allergen and one for a product. The product also should have a one to many unidirectional relationship.

Problem:
I created the entities like listed below and run the project – everything worked fine! But as soon as I add a new field to my product, I get the following error message:

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table products (id bigint not null, available boolean not null, description varchar(255), image_field blob, name varchar(100) not null, price integer not null check ((price_extern>=0) and (price_extern<=1000)), primary key (id))"; expects "identifier"

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table if exists products_allergens add constraint FKnf3ow75ap2qbokwprur8tdrg2 foreign key (product_id) references products" via JDBC [Table "products" not found;]

If I remove the new property, the code runs as expected. Also, it doesn’t make any difference which field I’m adding. String, Integer, all causes the same problem.

Allergen:

@Entity
@Table(name = "allergens")
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@ToString
public class Allergen {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "shortcut", unique = true, nullable = false)
    @NotBlank(message = "Shortcut cannot be blank")
    @Size(min = 1, max = 2)
    private String shortcut;

    @Column(name = "name", unique = true, nullable = false, length = 50)
    @NotBlank
    private String name;
}

Product:

@Entity
@Table(name = "products")
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@ToString
public class Product {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "name", unique = true, nullable = false, length = 100)
    @NotBlank(message = "Name cannot be blank")
    private String name;

    @Column(name = "description")
    private String description;

    @Column(name = "price", nullable = false)
    @NotBlank(message = "Price cannot be blank")
    @Min(0)
    @Max(1000)
    private int price = 0;

    @Column(name = "available", nullable = false)
    private boolean available = true;

    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
    @Column(name = "allergens")
    private List<Allergen> allergens;

    @Lob
    @Column(name = "image_field")
    private byte[] imageField;

}

And here are my property information in application.properties:

spring.application.name=backend

server.port=8000

spring.datasource.url=jdbc:h2:mem:testdb;DATABASE_TO_UPPER=false;
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=root
spring.datasource.password=

spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.defer-datasource-initialization=true

spring.h2.console.enabled=true
spring.h2.console.path=/h2

spring.sql.init.mode = always

Does anyone have any idea how to deal with this error message? Have I missed something? Apart from the two entities and the entries in the application.properties, nothing has been created or changed so far.

Thanks and have a great weekend!

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật