branch 3784-hibernate5 updated (1b9ef1b -> a34f43f)
This is an automated email from the git hooks/post-receive script. New change to branch 3784-hibernate5 in repository topia-2.x. See http://git.nuiton.org/topia-2.x.git from 1b9ef1b No special reason to fix javassist version new a34f43f refs #3784: Update to hibernate 5.1 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit a34f43f22087f407d7689570a7ad054e4d4c36a3 Author: Eric Chatellier <chatellier@codelutin.com> Date: Mon Feb 22 16:46:25 2016 +0100 refs #3784: Update to hibernate 5.1 Summary of changes: pom.xml | 2 +- .../main/java/org/nuiton/topia/TopiaContext.java | 7 ----- .../nuiton/topia/framework/TopiaContextImpl.java | 30 +++++----------------- .../java/org/nuiton/topia/framework/TopiaUtil.java | 6 ++--- .../topia/migration/mappings/TMSVersionDAO.java | 16 +++++++++--- 5 files changed, 22 insertions(+), 39 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch 3784-hibernate5 in repository topia-2.x. See http://git.nuiton.org/topia-2.x.git commit a34f43f22087f407d7689570a7ad054e4d4c36a3 Author: Eric Chatellier <chatellier@codelutin.com> Date: Mon Feb 22 16:46:25 2016 +0100 refs #3784: Update to hibernate 5.1 --- pom.xml | 2 +- .../main/java/org/nuiton/topia/TopiaContext.java | 7 ----- .../nuiton/topia/framework/TopiaContextImpl.java | 30 +++++----------------- .../java/org/nuiton/topia/framework/TopiaUtil.java | 6 ++--- .../topia/migration/mappings/TMSVersionDAO.java | 16 +++++++++--- 5 files changed, 22 insertions(+), 39 deletions(-) diff --git a/pom.xml b/pom.xml index 8b342be..a7a774e 100644 --- a/pom.xml +++ b/pom.xml @@ -215,7 +215,7 @@ <processorPluginVersion>1.3</processorPluginVersion> <nuitonI18nVersion>3.3</nuitonI18nVersion> <xmlrpcVersion>3.1.2</xmlrpcVersion> - <hibernateVersion>5.0.4.Final</hibernateVersion> + <hibernateVersion>5.1.0.Final</hibernateVersion> <sl4jVersion>1.7.6</sl4jVersion> <h2Version>1.3.175</h2Version> <hamcrestVersion>1.3</hamcrestVersion> diff --git a/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java b/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java index e4ef10b..b6799a4 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java @@ -136,13 +136,6 @@ public interface TopiaContext { void showCreateSchema() throws TopiaException; /** - * Permet de mettre à jour le schema de la base de données. - * - * @throws TopiaException if any exception - */ - void updateSchema() throws TopiaException; - - /** * Return a new context containing his own transaction. * * @return new context with transaction diff --git a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java index ae89161..075d7d1 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaContextImpl.java @@ -38,6 +38,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.EnumSet; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; @@ -72,6 +73,7 @@ import org.hibernate.service.ServiceRegistry; import org.hibernate.service.spi.Stoppable; import org.hibernate.tool.hbm2ddl.SchemaExport; import org.hibernate.tool.hbm2ddl.SchemaUpdate; +import org.hibernate.tool.schema.TargetType; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaContextFactory; import org.nuiton.topia.TopiaException; @@ -450,13 +452,12 @@ public class TopiaContextImpl implements TopiaContextImplementor { @Override public void createSchema() throws TopiaException { try { - boolean showSchema = false; + EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.DATABASE); if (log.isDebugEnabled()) { - showSchema = true; + targetTypes = EnumSet.of(TargetType.DATABASE, TargetType.STDOUT); } getFiresSupport().firePreCreateSchema(this); - new SchemaExport((MetadataImplementor)getMetadata()).create(showSchema, - true); + new SchemaExport().createOnly(targetTypes, getMetadata()); getFiresSupport().firePostCreateSchema(this); } catch (HibernateException eee) { throw new TopiaException( @@ -468,8 +469,7 @@ public class TopiaContextImpl implements TopiaContextImplementor { @Override public void showCreateSchema() throws TopiaException { try { - new SchemaExport((MetadataImplementor)getMetadata()). - execute(true, false, false, true); + new SchemaExport().createOnly(EnumSet.of(TargetType.STDOUT), getMetadata()); } catch (HibernateException eee) { throw new TopiaException( t("topia.persistence.error.create.schema", @@ -478,24 +478,6 @@ public class TopiaContextImpl implements TopiaContextImplementor { } @Override - public void updateSchema() throws TopiaException { - try { - boolean showSchema = false; - if (log.isDebugEnabled()) { - showSchema = true; - } - getFiresSupport().firePreUpdateSchema(this); - new SchemaUpdate((MetadataImplementor)getMetadata()).execute(showSchema, - true); - getFiresSupport().firePostUpdateSchema(this); - } catch (HibernateException eee) { - throw new TopiaException( - t("topia.persistence.error.update.schema", - eee.getMessage()), eee); - } - } - - @Override public Session getHibernate() throws TopiaException { if (hibernate == null) { throw new TopiaException( diff --git a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java index 91317e1..5f6d5a3 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaUtil.java @@ -263,7 +263,7 @@ public class TopiaUtil { * Test si une entite donnee correspondant a une configuration existe en * base. * - * @param configuration la configuration hibernate + * @param tx le context hibernate * @param entityName le nom de l'entite a tester * @return <tt>true</tt> si le schema de la table existe */ @@ -279,7 +279,7 @@ public class TopiaUtil { * Test if the db associated to the given {@code configuration} contaisn any of * the dealed entities. * - * @param configuration hibernate db configuration + * @param tx topia context * @return {@code true} if there is no schema for any of the dealed entities, * {@code false} otherwise. * @since 2.5.3 @@ -470,7 +470,7 @@ public class TopiaUtil { /** * Return hibernate schema name * - * @param config of hibernate + * @param tx topia context * @return schema name */ public static String getSchemaName(TopiaContext tx) { diff --git a/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java b/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java index 1312cd6..3e78c79 100644 --- a/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java +++ b/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java @@ -27,6 +27,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.EnumSet; import java.util.List; import org.apache.commons.logging.Log; @@ -38,6 +39,7 @@ import org.hibernate.boot.Metadata; import org.hibernate.boot.spi.MetadataImplementor; import org.hibernate.jdbc.Work; import org.hibernate.tool.hbm2ddl.SchemaExport; +import org.hibernate.tool.schema.TargetType; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaRuntimeException; @@ -77,15 +79,21 @@ public class TMSVersionDAO { public static void createTable(Metadata metatada) { // creer le schema en base // dans la configuration il n'y a que la table version - SchemaExport schemaExport = new SchemaExport((MetadataImplementor)metatada); - schemaExport.create(log.isDebugEnabled(), true); + EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.DATABASE); + if (log.isDebugEnabled()) { + targetTypes = EnumSet.of(TargetType.DATABASE, TargetType.STDOUT); + } + new SchemaExport().createOnly(targetTypes, metatada); } public static void dropTable(Metadata metatada) { // supprimer le schema en base // dans la configuration il n'y a que la table version - SchemaExport schemaExport = new SchemaExport((MetadataImplementor)metatada); - schemaExport.drop(log.isDebugEnabled(), true); + EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.DATABASE); + if (log.isDebugEnabled()) { + targetTypes = EnumSet.of(TargetType.DATABASE, TargetType.STDOUT); + } + new SchemaExport().drop(targetTypes, metatada); } public static TMSVersion create(TopiaContext tx, String version) throws TopiaException { -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm