create-script-source not executed for update action

Description

Having following in my persistence.xml:

<property name="javax.persistence.schema-generation.database.action" value="create" /> <property name="javax.persistence.schema-generation.create-source" value="script-then-metadata" /> <property name="javax.persistence.schema-generation.create-script-source" value="META-INF/execute-before-metadata-ddl.sql" />

then Hibernate at first executes the execute-before-metadata-ddl.sql file and then generates the remainig ddl via the metadata. That's fine.

However If I use the update action instead of the create action the execute-before-metadata-ddl.sql does not get executed anymore:

<property name="javax.persistence.schema-generation.database.action" value="update" />

I also tried

<property name="javax.persistence.schema-generation.update-script-source" value="META-INF/execute-before-metadata-ddl.sql" />

without any success.

I think there should be a way of executing a sql file when using the update action - either by just re-using the javax.persistence.schema-generation.create-script-source property or by introducing the property javax.persistence.schema-generation.update-script-source.

Thanks!

Activity

Show:

Matthias Kurz June 3, 2016 at 2:45 PM

This is NOT a duplicate of https://hibernate.atlassian.net/browse/HHH-10684#icft=HHH-10684 and also is not fixed in Hibernate 5.1.0 (I justed tested it)
Please read the issue description.

The question is: Is this actually consided to be a bug? Should the create-script-source only run on the create action (when the script-then-metadata flag is set of course)? Or on the update action as well?
Should we just leave it as it is and not execute a script at all for the update action? Or introduce an update-script-source setting?

What do you think?

Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Created May 15, 2016 at 8:47 PM
Updated June 3, 2016 at 2:45 PM
Resolved May 16, 2016 at 8:56 AM