From 7eecf93f9f64f5859da1cd57dcb7e2699cb0fd74 Mon Sep 17 00:00:00 2001 From: Nathan Voxland Date: Fri, 11 Oct 2013 14:17:25 -0500 Subject: [PATCH] Support hibernate 4 --- pom.xml | 14 +++++++------- .../hibernate/database/HibernateEjb3Database.java | 13 +++++++------ .../database/HibernateSpringDatabase.java | 2 +- .../hibernate/snapshot/TableSnapshotGenerator.java | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index eb116402..2ff93e19 100644 --- a/pom.xml +++ b/pom.xml @@ -3,8 +3,8 @@ 4.0.0 org.liquibase.ext - liquibase-hibernate3 - 3.1-SNAPSHOT + liquibase-hibernate4 + 3.0-SNAPSHOT Liquibase Hibernate Integration Liquibase extension for hibernate integration including generating changesets based on changed @@ -83,7 +83,7 @@ org.hibernate hibernate-core - 3.6.10.Final + 4.2.4.Final org.hibernate.javax.persistence @@ -93,12 +93,12 @@ org.hibernate hibernate-entitymanager - 3.6.10.Final + 4.2.4.Final org.hibernate hibernate-envers - 3.6.10.Final + 4.2.4.Final org.springframework @@ -132,8 +132,8 @@ org.springframework - spring-hibernate3 - 2.0.8 + spring-hibernate + 1.2.9 provided diff --git a/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java b/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java index 601ac275..aab39153 100644 --- a/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java +++ b/src/main/java/liquibase/ext/hibernate/database/HibernateEjb3Database.java @@ -8,7 +8,7 @@ import org.hibernate.cfg.NamingStrategy; import org.hibernate.ejb.Ejb3Configuration; import org.hibernate.envers.configuration.AuditConfiguration; -import org.hibernate.event.PostInsertEventListener; +import org.hibernate.event.spi.PostInsertEventListener; /** * Database implementation for "ejb3" hibernate configurations. @@ -44,11 +44,12 @@ protected Configuration buildConfiguration(HibernateConnection connection) throw } } - for (PostInsertEventListener postInsertEventListener : configuration.getEventListeners().getPostInsertEventListeners()) { - if (postInsertEventListener instanceof org.hibernate.envers.event.AuditEventListener) { - AuditConfiguration.getFor(configuration); - } - } +//I don't see how this is supported in hibernate 4 +// for (PostInsertEventListener postInsertEventListener : configuration.getEventListeners().getPostInsertEventListeners()) { +// if (postInsertEventListener instanceof org.hibernate.envers.event.AuditEventListener) { +// AuditConfiguration.getFor(configuration); +// } +// } return configuration; } diff --git a/src/main/java/liquibase/ext/hibernate/database/HibernateSpringDatabase.java b/src/main/java/liquibase/ext/hibernate/database/HibernateSpringDatabase.java index 13b7945b..70cb3eb8 100644 --- a/src/main/java/liquibase/ext/hibernate/database/HibernateSpringDatabase.java +++ b/src/main/java/liquibase/ext/hibernate/database/HibernateSpringDatabase.java @@ -3,9 +3,9 @@ import liquibase.database.DatabaseConnection; import liquibase.exception.DatabaseException; import liquibase.ext.hibernate.database.connection.HibernateConnection; +import org.hibernate.annotations.common.util.ReflectHelper; import org.hibernate.cfg.Configuration; import org.hibernate.ejb.Ejb3Configuration; -import org.hibernate.util.ReflectHelper; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; diff --git a/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java b/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java index 6d88ed79..67399701 100644 --- a/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java +++ b/src/main/java/liquibase/ext/hibernate/snapshot/TableSnapshotGenerator.java @@ -11,7 +11,7 @@ import liquibase.structure.core.Table; import org.hibernate.cfg.Configuration; import org.hibernate.dialect.Dialect; -import org.hibernate.engine.Mapping; +import org.hibernate.engine.spi.Mapping; import org.hibernate.mapping.PrimaryKey; import java.util.Iterator;