CCM NG: Changes for Hibernate 5
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4065 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
394fa73b85
commit
89c003b321
|
|
@ -48,7 +48,7 @@
|
|||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-envers</artifactId>
|
||||
<!--<scope>provided</scope>-->
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -23,10 +23,10 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.flywaydb.core.Flyway;
|
||||
import org.flywaydb.core.api.MigrationInfo;
|
||||
import org.flywaydb.core.internal.util.jdbc.JdbcUtils;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.integrator.spi.Integrator;
|
||||
import org.hibernate.metamodel.source.MetadataImplementor;
|
||||
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
|
||||
|
||||
import java.sql.Connection;
|
||||
|
|
@ -67,15 +67,14 @@ public class CcmIntegrator implements Integrator {
|
|||
* Checks for new and updated modules when the persistence unit is started.
|
||||
* If there are updates the necessary database migrations are executed.
|
||||
*
|
||||
* @param configuration
|
||||
* @param metadata
|
||||
* @param sessionFactory
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void integrate(final Configuration configuration,
|
||||
public void integrate(final Metadata metadata,
|
||||
final SessionFactoryImplementor sessionFactory,
|
||||
final SessionFactoryServiceRegistry registry) {
|
||||
//Find all modules in the classpath
|
||||
LOGGER.info("Retrieving modules...");
|
||||
modules = ServiceLoader.load(CcmModule.class);
|
||||
for (final CcmModule module : modules) {
|
||||
|
|
@ -117,9 +116,6 @@ public class CcmIntegrator implements Integrator {
|
|||
// }
|
||||
}
|
||||
|
||||
//Build Hibernate mappings for the entities.
|
||||
configuration.buildMappings();
|
||||
|
||||
} catch (DependencyException | SQLException ex) {
|
||||
throw new IntegrationException("Failed to integrate modules", ex);
|
||||
} finally {
|
||||
|
|
@ -298,13 +294,6 @@ public class CcmIntegrator implements Integrator {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void integrate(final MetadataImplementor metadata,
|
||||
final SessionFactoryImplementor sessionFactory,
|
||||
final SessionFactoryServiceRegistry registry) {
|
||||
//Nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the application is shutdown. Used to remove the database
|
||||
* schema of uninstalled modules.
|
||||
|
|
|
|||
|
|
@ -23,6 +23,11 @@ import nl.jqno.equalsverifier.Warning;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.libreccm.core.CcmObject;
|
||||
import org.libreccm.security.Group;
|
||||
import org.libreccm.security.Permission;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.security.User;
|
||||
import org.libreccm.tests.categories.UnitTest;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
||||
|
|
@ -73,6 +78,32 @@ public class EqualsAndHashCodeTest {
|
|||
final CcmApplication application2 = new CcmApplication();
|
||||
application2.setPrimaryUrl("http://application-two.exampl.org");
|
||||
|
||||
final CcmObject ccmObject1 = new CcmObject();
|
||||
ccmObject1.setObjectId(-100);
|
||||
ccmObject1.setDisplayName("Object 1");
|
||||
|
||||
final CcmObject ccmObject2 = new CcmObject();
|
||||
ccmObject1.setObjectId(-200);
|
||||
ccmObject1.setDisplayName("Object 2");
|
||||
|
||||
final Role role1 = new Role();
|
||||
role1.setName("role1");
|
||||
|
||||
final Role role2 = new Role();
|
||||
role2.setName("role2");
|
||||
|
||||
final Group group1 = new Group();
|
||||
group1.setName("group1");
|
||||
|
||||
final Group group2 = new Group();
|
||||
group2.setName("group2");
|
||||
|
||||
final User user1 = new TestUser();
|
||||
user1.setName("user1");
|
||||
|
||||
final User user2 = new TestUser();
|
||||
user2.setName("user2");
|
||||
|
||||
EqualsVerifier
|
||||
.forClass(entityClass)
|
||||
.suppress(Warning.STRICT_INHERITANCE)
|
||||
|
|
@ -81,7 +112,21 @@ public class EqualsAndHashCodeTest {
|
|||
.withPrefabValues(Category.class, category1, category2)
|
||||
.withPrefabValues(Domain.class, domain1, domain2)
|
||||
.withPrefabValues(CcmApplication.class, application1, application2)
|
||||
.withPrefabValues(CcmObject.class, ccmObject1, ccmObject2)
|
||||
.withPrefabValues(Role.class, role1, role2)
|
||||
.withPrefabValues(Group.class, group1, group2)
|
||||
.withPrefabValues(User.class, user1, user2)
|
||||
.verify();
|
||||
}
|
||||
|
||||
private class TestUser extends User {
|
||||
|
||||
private static final long serialVersionUID = -9052762220990453621L;
|
||||
|
||||
protected TestUser() {
|
||||
super();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
42
pom.xml
42
pom.xml
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>LPLv2 or newer</name>
|
||||
<name>LGPLv2 or newer</name>
|
||||
<url>http://www.gnu.org/licenses/lgpl-2.0.html</url>
|
||||
</license>
|
||||
</licenses>
|
||||
|
|
@ -76,7 +76,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<version>2.9</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
|
|
@ -135,7 +135,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<version>3.5</version>
|
||||
<version>3.5.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
@ -192,13 +192,13 @@
|
|||
</plugin>
|
||||
<plugin>
|
||||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate4-ddl-maven-plugin</artifactId>
|
||||
<artifactId>hibernate5-ddl-maven-plugin</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>0.7.5.201505241946</version>
|
||||
<version>0.7.6.201602180812</version>
|
||||
</plugin>
|
||||
<!--<plugin>
|
||||
<groupId>org.jboss.tattletale</groupId>
|
||||
|
|
@ -232,7 +232,7 @@
|
|||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>4.3.11.Final</version>
|
||||
<version>5.0.7.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
|
|
@ -242,7 +242,7 @@
|
|||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-envers</artifactId>
|
||||
<version>4.3.11.Final</version>
|
||||
<version>5.0.7.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
|
|
@ -251,12 +251,12 @@
|
|||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
<version>5.2.2.Final</version>
|
||||
<version>5.2.3.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator-cdi</artifactId>
|
||||
<version>5.2.2.Final</version>
|
||||
<version>5.2.3.Final</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<version>4.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Shiro lib for security stuff -->
|
||||
|
|
@ -329,7 +329,7 @@
|
|||
<dependency>
|
||||
<groupId>commons-cli</groupId>
|
||||
<artifactId>commons-cli</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
|
|
@ -339,7 +339,7 @@
|
|||
<dependency>
|
||||
<groupId>commons-collections</groupId>
|
||||
<artifactId>commons-collections</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<version>3.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
|
|
@ -354,7 +354,7 @@
|
|||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
|
|
@ -376,7 +376,7 @@
|
|||
<dependency>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
<artifactId>Saxon-HE</artifactId>
|
||||
<version>9.6.0-5</version>
|
||||
<version>9.7.0-4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -394,13 +394,13 @@
|
|||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>1.8.2</version>
|
||||
<version>1.9.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>3.3.3</version>
|
||||
<version>3.3.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -485,7 +485,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jboss.arquillian</groupId>
|
||||
<artifactId>arquillian-bom</artifactId>
|
||||
<version>1.1.10.Final</version>
|
||||
<version>1.1.11.Final</version>
|
||||
<scope>import</scope>
|
||||
<type>pom</type>
|
||||
</dependency>
|
||||
|
|
@ -514,7 +514,7 @@
|
|||
<dependency>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>org.jacoco.core</artifactId>
|
||||
<version>0.7.5.201505241946</version>
|
||||
<version>0.7.6.201602180812</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
@ -542,14 +542,14 @@
|
|||
<dependency>
|
||||
<groupId>nl.jqno.equalsverifier</groupId>
|
||||
<artifactId>equalsverifier</artifactId>
|
||||
<version>1.7.6</version>
|
||||
<version>1.7.8</version>
|
||||
</dependency>
|
||||
|
||||
<!-- h2 database in used to check some database related things -->
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.4.190</version>
|
||||
<version>1.4.191</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
|||
Loading…
Reference in New Issue