CoderJammer
CoderJammer

Reputation: 715

Connecting with DBEaver Strange Table appears

I'm Using DBeaver 24.3.2, SpringBoot 3.4.1, Java 21.0.5, flyway 11.2.0. The persistence library are all inherited from spring-data.

I recently switched to SpringBoot 3.4 and, doing an example project, I noticed a pretty strange behavior. I have the follow flyway and datasource config:

########## DATASOURCE CONFIG ##############
spring.datasource.url=jdbc:h2:file:D:/h2-dbms/rest-api/restapidb;AUTO_SERVER=TRUE;
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver
spring.h2.console.enabled=true
spring.h2.console.settings.trace=false
spring.h2.console.settings.web-allow-others=false
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

############ FLYWAY CONFIG ################
spring.flyway.user=sa
spring.flyway.password=
spring.flyway.locations=classpath:migration

My ddl is so easy that it's not even worth writing, there are just two tables in many-to-many relationships.

All works fine but, If I connect to my DB with DBeaver, the first time all seems normal, the second time I see other two table similar to mine (the difference is the prefix HTE_ and a column RN_ type integer):

enter image description here

As you can see the tables ROLES, USERS and USERS_ROLES are correct but I don't know what HTE_USERS and HTE_ROLES means.

Another strange thing is that the HTE tables are the same column plus one RN_ (Integer):

enter image description here

What a hell is that?? If I open the DB with the web console at http:/localhost:8080/h2-console (always using file mode and not in-memory) nothing of this happens.

Do you have some idea?

N.B.: I clearly don't use envers or other audit framework.

Upvotes: 0

Views: 35

Answers (1)

CoderJammer
CoderJammer

Reputation: 715

Is not an error is a normal behavior by Hibernate creating these temps table if you use sequence with allocationSize greather than 1.

As they said allocationSize with value equals to 1 causes lack of performance this is the reasons wy the default is 50.

Anyway starting from Hibernate 6.2.0 CR1 you can disable the creation of these tables with:

hibernate.hql.bulk_id_strategy.global_temporary.create_tables=false

but seems is not a good practice.

more info here.

Hope helps.

Upvotes: 0

Related Questions