Due to dependencies upgrade:
- spring-boot-starter-parent:2.7.1 -> 3.0.0
- mysql:mysql-connector-java -> com.mysql:mysql-connector-j
I started to use hibernate-core-6.1.5
with his new strategy to give names to tables.
So now tests are broken because when I want to save data to some some table a "_SEQ" is added to the table's name and the test won't find the table.
Investigating I finded some source:
- https://thorben-janssen.com/things-to-know-when-migrating-to-hibernate-6-x/#3_New_naming_strategy_for_default_sequences
- https://www.baeldung.com/hibernate-entitymanager
- xmlns, xmlns:xsi, xsi:schemaLocation, and targetNamespace?
- https://github.com/spring-projects/spring-data-jpa/issues/2717
- https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x
To bypass the problem I'm specifying the strategy inside every entity:
@Entity
@Table(name = "animal")
public class Animal {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) // this will overwrite SEQUENCE
@Column(name = "id")
private Long id;
Could this be done in the application.yml?