Prevent Hiberate 5 to create FK and Tables if already existing

Description

I'm migrating my application from 4.2.2.Final to 5.2.8.Final. Because I use envers, I need to set the property hbm2ddl to update. When I start the server, Hibernate returns these errors:

It complains about tables and FK, even about the table REVINFO with all the envers' history. It never happened with Hibernate 4, even after restoring an existing db.

Do you know how to fix it? Is it a bug? I can't crearly delete the tables.

The dialect I'm using is org.hibernate.dialect.SQLServer2008Dialect

Environment

None

Activity

Show:
Chris Cranford
July 10, 2017, 1:36 PM
Edited

FWIW, you do not need to use that setting because you're using Envers. While that setting is nice to migrate or create database objects after you've made some developer changes, its really something that isn't necessary as there exists other ways including Hibernate's tooling tasks for creating schema scripts that you can use.

You mention the setting is set to true, why? The value's proper value-set is create, create-drop, validate, or validate. Is the setting something you're passing directly to Hibernate or is this some hbm2ddl setting you're providing to a third-party like Spring Data?

Saul Giordani
July 10, 2017, 2:14 PM

Sorry, I meant set to "update", I edited the description now.
As you said, I set it to "none" now and it seems that envers is still working, this s good news.

Besides, I'd like to understand how to prevent hibernate to create objects (tables and FK) that already exist.

Chris Cranford
July 10, 2017, 2:19 PM

Mind attaching a test case that replicates this failure for us with two simple entities? It seems strange that you'd get an object exists error while using update ?

Assignee

Unassigned

Reporter

Saul Giordani

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure