Hibernate executes commands that I didn't write. Why could that be?

The drop table and create table statements are executed because you use hibernate.hbm2ddl.auto=create-drop. When the SessionFactory is built, it will then drop an create tables.
I don’t know where the insert statements are coming from, but you seem to already have figured out that you are probably running code from a previous compilation/publish run. I don’t know how your run configuration in IntelliJ looks like, but it’s not a problem with Hibernate. Inspect the JARs that are used for this run configuration to see what code is executed. If you have further questions about this, please ask these questions on StackOverflow, as the problem has nothing to do with Hibernate.

1 Like