Setting <property name="hibernate.hbm2ddl.auto" value="create" /> does not drop tables previous to creating them. That was the behavior up to at least 3.6.0 and was extremely useful for test cases.
To reproduce, run attached test case twice.
08:27:44,503 [main] DEBUG SqlStatementLogger - create table Customer (id int8 not null, primary key (id))
08:27:44,504 [main] ERROR SchemaExport - HHH00389:Unsuccessful: create table Customer (id int8 not null, primary key (id))
08:27:44,504 [main] ERROR SchemaExport - ERROR: relation "customer" already exists
08:27:44,505 [main] INFO SchemaExport - HHH00230:Schema export complete
No: "With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly."
The behaviour of "create" up to 3.6.0 was to drop tables if they already existed, before creating them.
Right, this is a bug if true and certainly a regression as you mention. But it will not make today's release cut.
Lukasz, sorry, didn't know you were working on it until I was about to commit my fix.
I see that your pull request makes changes to how SessionFactoryImpl uses SchemaExport.
I've created a pull request that restores the 3.6 behavior, where SchemaExport.create() executes the drop script before executing the create script:
Steve, you decide which is preferred.
Firstly, sorry to make a comment on a "CLOSED" jira, however, due to this fix, I am having an ERROR message shows those tables were not existed on running drop scripts. (the drop table is fine, as they mostly will include the 'if exists', but before dropping the table, it will drop those foreign key constraints), detailed please see my thread in Hibernate forum. https://forum.hibernate.org/viewtopic.php?f=1&t=1012898