Skip to content

The Unified and Autonomous Development Platform

midwork

robin shine9c40a135b58b
diff --git a/commons.hibernate/ojdbc14.jar b/commons.hibernate/ojdbc14.jar
deleted file mode 100644
index f41cf1ae9f..0000000000
Binary files a/commons.hibernate/ojdbc14.jar and /dev/null differ
diff --git a/commons.hibernate/pom.xml b/commons.hibernate/pom.xml
index dfbe54cdd5..e6ba806cd7 100644
--- a/commons.hibernate/pom.xml
+++ b/commons.hibernate/pom.xml
@@ -44,6 +44,22 @@
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernateVersion}</version>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-hikaricp</artifactId>
+ <version>${hibernateVersion}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP-java6</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.zaxxer</groupId>
+ <artifactId>HikariCP</artifactId>
+ <version>2.4.3</version>
+ </dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
@@ -54,28 +70,11 @@
<artifactId>hsqldb</artifactId>
<version>2.3.3</version>
</dependency>
- <dependency>
- <groupId>com.jolbox</groupId>
- <artifactId>bonecp</artifactId>
- <version>0.8.0.RELEASE</version>
- </dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
</dependency>
- <dependency>
- <groupId>com.oracle</groupId>
- <artifactId>ojdbc14</artifactId>
- <version>10.2.0.4.0</version>
- <scope>system</scope>
- <systemPath>${project.basedir}/ojdbc14.jar</systemPath>
- </dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <version>1.3.0</version>
- </dependency>
<dependency>
<groupId>com.pmease</groupId>
<artifactId>commons.jackson</artifactId>
@@ -106,7 +105,7 @@
</repositories>
<properties>
<moduleClass>com.pmease.commons.hibernate.HibernateModule</moduleClass>
- <hibernateVersion>4.2.5.Final</hibernateVersion>
+ <hibernateVersion>5.1.0.Final</hibernateVersion>
</properties>
<version>1.0.30</version>
</project>
diff --git a/commons.hibernate/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java b/commons.hibernate/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java
deleted file mode 100644
index 5c531a0eb4..0000000000
--- a/commons.hibernate/src/main/java/com/jolbox/bonecp/provider/BoneCPConnectionProvider.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/**
- * Copyright 2010 Wallace Wadge
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.jolbox.bonecp.provider;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Map;
-import java.util.Properties;
-
-import org.hibernate.HibernateException;
-import org.hibernate.cfg.AvailableSettings;
-import org.hibernate.internal.util.config.ConfigurationHelper;
-import org.hibernate.service.UnknownUnwrapTypeException;
-import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
-import org.hibernate.service.spi.Configurable;
-import org.hibernate.service.spi.Stoppable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.jolbox.bonecp.BoneCP;
-import com.jolbox.bonecp.BoneCPConfig;
-import com.jolbox.bonecp.hooks.ConnectionHook;
-
-
-/**
- * Hibernate Connection Provider.
- *
- * @author wallacew
- */
-public class BoneCPConnectionProvider implements ConnectionProvider,Configurable,Stoppable {
- /**
- * uid
- */
- private static final long serialVersionUID = -5236029951415598543L;
- /** Config key. */
- protected static final String CONFIG_CONNECTION_DRIVER_CLASS = "hibernate.connection.driver_class";
- /** Config key. */
- protected static final String CONFIG_CONNECTION_PASSWORD = "hibernate.connection.password";
- /** Config key. */
- protected static final String CONFIG_CONNECTION_USERNAME = "hibernate.connection.username";
- /** Config key. */
- protected static final String CONFIG_CONNECTION_URL = "hibernate.connection.url";
- /** Config key. */
- protected static final String CONFIG_CONNECTION_DRIVER_CLASS_ALTERNATE = "javax.persistence.jdbc.driver";
- /** Config key. */
- protected static final String CONFIG_CONNECTION_PASSWORD_ALTERNATE = "javax.persistence.jdbc.password";
- /** Config key. */
- protected static final String CONFIG_CONNECTION_USERNAME_ALTERNATE = "javax.persistence.jdbc.user";
- /** Config key. */
- protected static final String CONFIG_CONNECTION_URL_ALTERNATE = "javax.persistence.jdbc.url";
- /** Connection pool handle. */
- private BoneCP pool;
- /** Isolation level. */
- private Integer isolation;
- /** Autocommit option. */
- private boolean autocommit;
- /** Classloader to use to load the jdbc driver. */
- private ClassLoader classLoader;
- /** Configuration handle. */
- private BoneCPConfig config;
- /** Class logger. */
- private static Logger logger = LoggerFactory.getLogger(BoneCPConnectionProvider.class);
-
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.service.jdbc.connections.spi.ConnectionProvider#closeConnection(java.sql.Connection)
- */
- public void closeConnection(Connection conn) throws SQLException {
- conn.close();
- }
-
- /**
- * Pool configuration.
- * @param props
- * @throws HibernateException
- */
- public void configure(Properties props) throws HibernateException {
- try{
- this.config = new BoneCPConfig(props);
-
- // old hibernate config
- String url = props.getProperty(CONFIG_CONNECTION_URL);
- String username = props.getProperty(CONFIG_CONNECTION_USERNAME);
- String password = props.getProperty(CONFIG_CONNECTION_PASSWORD);
- String driver = props.getProperty(CONFIG_CONNECTION_DRIVER_CLASS);
- if (url == null){
- url = props.getProperty(CONFIG_CONNECTION_URL_ALTERNATE);
- }
- if (username == null){
- username = props.getProperty(CONFIG_CONNECTION_USERNAME_ALTERNATE);
- }
- if (password == null){
- password = props.getProperty(CONFIG_CONNECTION_PASSWORD_ALTERNATE);
- }
- if (driver == null){
- driver = props.getProperty(CONFIG_CONNECTION_DRIVER_CLASS_ALTERNATE);
- }
-
- if (url != null){
- this.config.setJdbcUrl(url);
- }
- if (username != null){
- this.config.setUsername(username);
- }
- if (password != null){
- this.config.setPassword(password);
- }
-
-
- // Remember Isolation level
- this.isolation = ConfigurationHelper.getInteger(AvailableSettings.ISOLATION, props);
- this.autocommit = ConfigurationHelper.getBoolean(AvailableSettings.AUTOCOMMIT, props);
-
- logger.debug(this.config.toString());
-
- if (driver != null && !driver.trim().equals("")){
- loadClass(driver);
- }
- if (this.config.getConnectionHookClassName() != null){
- Object hookClass = loadClass(this.config.getConnectionHookClassName()).newInstance();
- this.config.setConnectionHook((ConnectionHook) hookClass);
- }
- // create the connection pool
- this.pool = createPool(this.config);
- } catch (Exception e) {
- throw new HibernateException(e);
- }
- }
-
- /** Loads the given class, respecting the given classloader.
- * @param clazz class to load
- * @return Loaded class
- * @throws ClassNotFoundException
- */
- protected Class<?> loadClass(String clazz) throws ClassNotFoundException {
- if (this.classLoader == null){
- return Class.forName(clazz);
- }
-
- return Class.forName(clazz, true, this.classLoader);
-
- }
-
- /** Creates the given connection pool with the given configuration. Extracted here to make unit mocking easier.
- * @param config configuration object.
- * @return BoneCP connection pool handle.
- */
- protected BoneCP createPool(BoneCPConfig config) {
- try{
- return new BoneCP(config);
- } catch (SQLException e) {
- throw new HibernateException(e);
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.service.jdbc.connections.spi.ConnectionProvider#getConnection()
- */
- public Connection getConnection() throws SQLException {
- Connection connection = this.pool.getConnection();
-
- // set the Transaction Isolation if defined
- try {
- // set the Transaction Isolation if defined
- if ((this.isolation != null) && (connection.getTransactionIsolation() != this.isolation.intValue())) {
- connection.setTransactionIsolation (this.isolation.intValue());
- }
-
- // toggle autoCommit to false if set
- if ( connection.getAutoCommit() != this.autocommit ){
- connection.setAutoCommit(this.autocommit);
- }
-
- return connection;
- } catch (SQLException e){
- try {
- connection.close();
- } catch (Exception e2) {
- logger.warn("Setting connection properties failed and closing this connection failed again", e);
- }
-
- throw e;
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.hibernate.service.jdbc.connections.spi.ConnectionProvider#supportsAggressiveRelease()
- */
- public boolean supportsAggressiveRelease() {
- return false;
- }
-
- /** Returns the configuration object being used.
- * @return configuration object
- */
- protected BoneCPConfig getConfig() {
- return this.config;
- }
-
- /** Returns the classloader to use when attempting to load the jdbc driver (if a value is given).
- * @return the classLoader currently set.
- */
- public ClassLoader getClassLoader() {
- return this.classLoader;
- }
-
- /** Specifies the classloader to use when attempting to load the jdbc driver (if a value is given). Set to null to use the default
- * loader.
- * @param classLoader the classLoader to set
- */
- public void setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- @Override
- public boolean isUnwrappableAs(@SuppressWarnings("rawtypes") Class unwrapType) {
- return ConnectionProvider.class.equals( unwrapType ) ||
- BoneCPConnectionProvider.class.isAssignableFrom( unwrapType );
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T unwrap(Class<T> unwrapType) {
- if ( ConnectionProvider.class.equals( unwrapType ) ||
- BoneCPConnectionProvider.class.isAssignableFrom( unwrapType ) ) {
- return (T) this;
- }
-
- throw new UnknownUnwrapTypeException( unwrapType );
- }
-
-
- /**
- * Legacy conversion.
- * @param map
- * @return Properties
- */
- private Properties mapToProperties(Map<String, String> map) {
- Properties p = new Properties();
- for (Map.Entry<String,String> entry : map.entrySet()) {
- p.put(entry.getKey(), entry.getValue());
- }
- return p;
- }
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Override
- public void configure(Map configurationValues) {
- configure(mapToProperties(configurationValues));
- }
-
- @Override
- public void stop() {
- close();
- }
-
- /**
- * alias for stop.
- */
- public void close(){
- this.pool.shutdown();
- }
-}
diff --git a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/ConfigurationProvider.java b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/ConfigurationProvider.java
index a82e81d3e2..e5ec7ca297 100644
--- a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/ConfigurationProvider.java
+++ b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/ConfigurationProvider.java
@@ -11,9 +11,9 @@ import javax.inject.Singleton;
import org.hibernate.CallbackException;
import org.hibernate.EmptyInterceptor;
+import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
-import org.hibernate.cfg.NamingStrategy;
import org.hibernate.type.Type;
import com.google.inject.Provider;
@@ -28,14 +28,14 @@ public class ConfigurationProvider implements Provider<Configuration> {
private final Set<ModelProvider> modelProviders;
- private final NamingStrategy namingStrategy;
+ private final PhysicalNamingStrategy namingStrategy;
private final Properties hibernateProperties;
private final Set<HibernateListener> hibernateListeners;
@Inject
- public ConfigurationProvider(Set<ModelProvider> modelProviders, NamingStrategy namingStrategy,
+ public ConfigurationProvider(Set<ModelProvider> modelProviders, PhysicalNamingStrategy namingStrategy,
@Nullable @Named("hibernate") Properties hibernateProperties,
Set<HibernateListener> hibernateListeners) {
this.modelProviders = modelProviders;
@@ -55,7 +55,7 @@ public class ConfigurationProvider implements Provider<Configuration> {
StringUtils.replace(url, "${installDir}", Bootstrap.installDir.getAbsolutePath()));
configuration = new Configuration();
- configuration.setNamingStrategy(namingStrategy);
+ configuration.setPhysicalNamingStrategy(namingStrategy);
for (Class<? extends AbstractEntity> each: ClassUtils.findImplementations(AbstractEntity.class, AbstractEntity.class)) {
configuration.addAnnotatedClass(each);
}
diff --git a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DefaultPersistService.java b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DefaultPersistService.java
index 74d704354a..8c0ee22a46 100644
--- a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DefaultPersistService.java
+++ b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DefaultPersistService.java
@@ -20,7 +20,7 @@ public class DefaultPersistService implements PersistService, Provider<SessionFa
this.configurationProvider = configurationProvider;
}
- @SuppressWarnings("deprecation")
+ @Override
public void start() {
Preconditions.checkState(sessionFactory == null);
if (configurationProvider.get() != null) {
@@ -28,6 +28,7 @@ public class DefaultPersistService implements PersistService, Provider<SessionFa
}
}
+ @Override
public void stop() {
if (sessionFactory != null) {
Preconditions.checkState(!sessionFactory.isClosed());
diff --git a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DirectConnectionProvider.java b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DirectConnectionProvider.java
index 9fe5c99e77..e8cec97bc4 100644
--- a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DirectConnectionProvider.java
+++ b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/DirectConnectionProvider.java
@@ -1,71 +1,71 @@
-package com.pmease.commons.hibernate;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import javax.inject.Singleton;
-
-import org.hibernate.HibernateException;
-import org.hibernate.cfg.AvailableSettings;
-import org.hibernate.service.UnknownUnwrapTypeException;
-import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
-
-import com.google.inject.Key;
-import com.google.inject.name.Names;
-import com.pmease.commons.loader.AppLoader;
-import com.pmease.commons.util.ExceptionUtils;
-
-@Singleton
-@SuppressWarnings("serial")
-public class DirectConnectionProvider implements ConnectionProvider {
-
- public void close() throws HibernateException {
-
- }
-
- public void closeConnection(Connection conn) throws SQLException {
- conn.close();
- }
-
- public void configure(Properties props) throws HibernateException {
-
- }
-
- public Connection getConnection() throws SQLException {
- Properties props = AppLoader.injector.getInstance(Key.get(Properties.class, Names.named("hibernate")));
- try {
- Class.forName(props.getProperty(AvailableSettings.DRIVER));
- Connection conn = DriverManager.getConnection(
- props.getProperty(AvailableSettings.URL),
- props.getProperty(AvailableSettings.USER),
- props.getProperty(AvailableSettings.PASS));
- conn.setAutoCommit(true);
- return conn;
- } catch (Exception e) {
- throw ExceptionUtils.unchecked(e);
- }
- }
-
- public boolean supportsAggressiveRelease() {
- return false;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public boolean isUnwrappableAs(Class unwrapType) {
- return DirectConnectionProvider.class.equals(unwrapType);
- }
-
- @Override
- @SuppressWarnings({ "unchecked" })
- public <T> T unwrap(Class<T> unwrapType) {
- if (isUnwrappableAs(unwrapType)) {
- return (T) this;
- } else {
- throw new UnknownUnwrapTypeException(unwrapType);
- }
- }
-
-}
+package com.pmease.commons.hibernate;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import javax.inject.Singleton;
+
+import org.hibernate.HibernateException;
+import org.hibernate.cfg.AvailableSettings;
+import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
+import org.hibernate.service.UnknownUnwrapTypeException;
+
+import com.google.inject.Key;
+import com.google.inject.name.Names;
+import com.pmease.commons.loader.AppLoader;
+import com.pmease.commons.util.ExceptionUtils;
+
+@Singleton
+@SuppressWarnings("serial")
+public class DirectConnectionProvider implements ConnectionProvider {
+
+ public void close() throws HibernateException {
+
+ }
+
+ public void closeConnection(Connection conn) throws SQLException {
+ conn.close();
+ }
+
+ public void configure(Properties props) throws HibernateException {
+
+ }
+
+ public Connection getConnection() throws SQLException {
+ Properties props = AppLoader.injector.getInstance(Key.get(Properties.class, Names.named("hibernate")));
+ try {
+ Class.forName(props.getProperty(AvailableSettings.DRIVER));
+ Connection conn = DriverManager.getConnection(
+ props.getProperty(AvailableSettings.URL),
+ props.getProperty(AvailableSettings.USER),
+ props.getProperty(AvailableSettings.PASS));
+ conn.setAutoCommit(true);
+ return conn;
+ } catch (Exception e) {
+ throw ExceptionUtils.unchecked(e);
+ }
+ }
+
+ public boolean supportsAggressiveRelease() {
+ return false;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public boolean isUnwrappableAs(Class unwrapType) {
+ return DirectConnectionProvider.class.equals(unwrapType);
+ }
+
+ @Override
+ @SuppressWarnings({ "unchecked" })
+ public <T> T unwrap(Class<T> unwrapType) {
+ if (isUnwrappableAs(unwrapType)) {
+ return (T) this;
+ } else {
+ throw new UnknownUnwrapTypeException(unwrapType);
+ }
+ }
+
+}
diff --git a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/HibernateModule.java b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/HibernateModule.java
index 2f796bc8c1..3a2294c336 100644
--- a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/HibernateModule.java
+++ b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/HibernateModule.java
@@ -1,61 +1,61 @@
-package com.pmease.commons.hibernate;
-
-import java.util.Properties;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.ImprovedNamingStrategy;
-import org.hibernate.cfg.NamingStrategy;
-
-import com.google.inject.matcher.Matchers;
-import com.google.inject.name.Names;
-import com.google.inject.util.Providers;
-import com.pmease.commons.hibernate.dao.DefaultDao;
-import com.pmease.commons.hibernate.dao.Dao;
-import com.pmease.commons.hibernate.jackson.HibernateObjectMapperConfigurator;
-import com.pmease.commons.jackson.ObjectMapperConfigurator;
-import com.pmease.commons.jetty.ServletConfigurator;
-import com.pmease.commons.loader.AbstractPlugin;
-import com.pmease.commons.loader.AbstractPluginModule;
-
-public class HibernateModule extends AbstractPluginModule {
-
- @Override
- protected void configure() {
- super.configure();
-
- // Use an optional binding here in case our client does not like to
- // start persist service provided by this plugin
- bind(Properties.class).annotatedWith(Names.named("hibernate")).toProvider(Providers.<Properties>of(null));
- bind(NamingStrategy.class).to(ImprovedNamingStrategy.class);
-
- bind(PersistService.class).to(DefaultPersistService.class);
- bind(SessionFactory.class).toProvider(DefaultPersistService.class);
- bind(Configuration.class).toProvider(ConfigurationProvider.class);
- bind(UnitOfWork.class).to(DefaultUnitOfWork.class);
- bind(Session.class).toProvider(DefaultUnitOfWork.class);
-
- bind(Dao.class).to(DefaultDao.class);
-
- TransactionInterceptor transactionInterceptor = new TransactionInterceptor();
- requestInjection(transactionInterceptor);
-
- bindInterceptor(Matchers.any(), Matchers.annotatedWith(Transactional.class), transactionInterceptor);
-
- SessionInterceptor sessionInterceptor = new SessionInterceptor();
- requestInjection(sessionInterceptor);
-
- bindInterceptor(Matchers.any(), Matchers.annotatedWith(Sessional.class), sessionInterceptor);
-
- contribute(ObjectMapperConfigurator.class, HibernateObjectMapperConfigurator.class);
-
- contribute(ServletConfigurator.class, HibernateServletConfigurator.class);
- }
-
- @Override
- protected Class<? extends AbstractPlugin> getPluginClass() {
- return HibernatePlugin.class;
- }
-
-}
+package com.pmease.commons.hibernate;
+
+import java.util.Properties;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
+import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
+import org.hibernate.cfg.Configuration;
+
+import com.google.inject.matcher.Matchers;
+import com.google.inject.name.Names;
+import com.google.inject.util.Providers;
+import com.pmease.commons.hibernate.dao.Dao;
+import com.pmease.commons.hibernate.dao.DefaultDao;
+import com.pmease.commons.hibernate.jackson.HibernateObjectMapperConfigurator;
+import com.pmease.commons.jackson.ObjectMapperConfigurator;
+import com.pmease.commons.jetty.ServletConfigurator;
+import com.pmease.commons.loader.AbstractPlugin;
+import com.pmease.commons.loader.AbstractPluginModule;
+
+public class HibernateModule extends AbstractPluginModule {
+
+ @Override
+ protected void configure() {
+ super.configure();
+
+ // Use an optional binding here in case our client does not like to
+ // start persist service provided by this plugin
+ bind(Properties.class).annotatedWith(Names.named("hibernate")).toProvider(Providers.<Properties>of(null));
+ bind(PhysicalNamingStrategy.class).to(PhysicalNamingStrategyStandardImpl.class);
+
+ bind(PersistService.class).to(DefaultPersistService.class);
+ bind(SessionFactory.class).toProvider(DefaultPersistService.class);
+ bind(Configuration.class).toProvider(ConfigurationProvider.class);
+ bind(UnitOfWork.class).to(DefaultUnitOfWork.class);
+ bind(Session.class).toProvider(DefaultUnitOfWork.class);
+
+ bind(Dao.class).to(DefaultDao.class);
+
+ TransactionInterceptor transactionInterceptor = new TransactionInterceptor();
+ requestInjection(transactionInterceptor);
+
+ bindInterceptor(Matchers.any(), Matchers.annotatedWith(Transactional.class), transactionInterceptor);
+
+ SessionInterceptor sessionInterceptor = new SessionInterceptor();
+ requestInjection(sessionInterceptor);
+
+ bindInterceptor(Matchers.any(), Matchers.annotatedWith(Sessional.class), sessionInterceptor);
+
+ contribute(ObjectMapperConfigurator.class, HibernateObjectMapperConfigurator.class);
+
+ contribute(ServletConfigurator.class, HibernateServletConfigurator.class);
+ }
+
+ @Override
+ protected Class<? extends AbstractPlugin> getPluginClass() {
+ return HibernatePlugin.class;
+ }
+
+}
diff --git a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/PrefixedNamingStrategy.java b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/PrefixedNamingStrategy.java
index c6b7592ac0..f7d6877210 100644
--- a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/PrefixedNamingStrategy.java
+++ b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/PrefixedNamingStrategy.java
@@ -1,61 +1,40 @@
-/*
- * Copyright PMEase (c) 2005-2008,
- * Date: Feb 24, 2008
- * Time: 4:29:05 PM
- * All rights reserved.
- *
- * Revision: $Id: PersistenceNamingStrategy.java 1209 2008-07-28 00:16:18Z robin $
- */
-package com.pmease.commons.hibernate;
-
-import org.hibernate.AssertionFailure;
-import org.hibernate.cfg.ImprovedNamingStrategy;
-import org.hibernate.internal.util.StringHelper;
-
-public class PrefixedNamingStrategy extends ImprovedNamingStrategy {
- private static final long serialVersionUID = 1L;
-
- private String prefix;
-
- public PrefixedNamingStrategy(String prefix) {
- this.prefix = prefix;
- }
-
- @Override
- public String classToTableName(String className) {
- return prefix + "_" + addUnderscores(
- StringHelper.unqualify(className)).toUpperCase();
- }
-
- @Override
- public String propertyToColumnName(String propertyName) {
- return prefix + "_" + addUnderscores(
- StringHelper.unqualify(propertyName)).toUpperCase();
- }
-
- @Override
- public String logicalCollectionColumnName(String columnName,
- String propertyName, String referencedColumn) {
- if ((propertyToColumnName(propertyName) + "_" +
- referencedColumn.toUpperCase())
- .equalsIgnoreCase(columnName)) {
- return StringHelper.unqualify(propertyName);
- } else {
- return StringHelper.isNotEmpty( columnName ) ?
- columnName :
- StringHelper.unqualify( propertyName );
- }
- }
-
- @Override
- public String foreignKeyColumnName(String propertyName,
- String propertyEntityName, String propertyTableName,
- String referencedColumnName) {
- String header = propertyName != null ?
- StringHelper.unqualify( propertyName ) : propertyTableName;
- if (header == null)
- throw new AssertionFailure("NamingStrategy not properly filled");
- return prefix + "_" + columnName(header).toUpperCase() +
- "_" + referencedColumnName.toUpperCase();
- }
-}
+/*
+ * Copyright PMEase (c) 2005-2008,
+ * Date: Feb 24, 2008
+ * Time: 4:29:05 PM
+ * All rights reserved.
+ *
+ * Revision: $Id: PersistenceNamingStrategy.java 1209 2008-07-28 00:16:18Z robin $
+ */
+package com.pmease.commons.hibernate;
+
+import org.hibernate.boot.model.naming.Identifier;
+import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
+import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
+
+public class PrefixedNamingStrategy extends PhysicalNamingStrategyStandardImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ private String prefix;
+
+ public PrefixedNamingStrategy(String prefix) {
+ this.prefix = prefix;
+ }
+
+ @Override
+ public Identifier toPhysicalTableName(Identifier name, JdbcEnvironment context) {
+ return super.toPhysicalSequenceName(name, context);
+ }
+
+ @Override
+ public Identifier toPhysicalSequenceName(Identifier name, JdbcEnvironment context) {
+ return super.toPhysicalSequenceName(name, context);
+ }
+
+ @Override
+ public Identifier toPhysicalColumnName(Identifier name, JdbcEnvironment context) {
+ return super.toPhysicalColumnName(name, context);
+ }
+
+}
diff --git a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/TransactionInterceptor.java b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/TransactionInterceptor.java
index 08d1213f57..486c3c8db9 100644
--- a/commons.hibernate/src/main/java/com/pmease/commons/hibernate/TransactionInterceptor.java
+++ b/commons.hibernate/src/main/java/com/pmease/commons/hibernate/TransactionInterceptor.java
@@ -13,6 +13,7 @@ import org.aopalliance.intercept.MethodInvocation;
import org.hibernate.FlushMode;
import org.hibernate.Session;
import org.hibernate.Transaction;
+import org.hibernate.resource.transaction.spi.TransactionStatus;
import com.google.inject.Inject;
@@ -25,7 +26,7 @@ public class TransactionInterceptor implements MethodInterceptor {
unitOfWork.begin();
try {
Session session = unitOfWork.getSession();
- if (session.getTransaction().isActive()) {
+ if (session.getTransaction().getStatus() == TransactionStatus.ACTIVE) {
return mi.proceed();
} else {
FlushMode previousMode = session.getFlushMode();
diff --git a/commons.loader/pom.xml b/commons.loader/pom.xml
index 80c6d52229..375943304b 100644
--- a/commons.loader/pom.xml
+++ b/commons.loader/pom.xml
@@ -64,11 +64,6 @@
<artifactId>guice-multibindings</artifactId>
<version>${guiceVersion}</version>
</dependency>
- <dependency>
- <groupId>org.hibernate.javax.persistence</groupId>
- <artifactId>hibernate-jpa-2.0-api</artifactId>
- <version>1.0.1.Final</version>
- </dependency>
</dependencies>
<repositories>
<repository>
@@ -88,6 +83,6 @@
</repository>
</repositories>
<properties>
- <guiceVersion>4.0-beta5</guiceVersion>
+ <guiceVersion>4.0</guiceVersion>
</properties>
</project>
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java
index 332a3bb79f..c2ffaa7b6a 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/CoreModule.java
@@ -4,7 +4,7 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
import com.google.common.collect.Sets;
import com.pmease.commons.git.GitConfig;
@@ -19,10 +19,10 @@ import com.pmease.commons.loader.ImplementationProvider;
import com.pmease.commons.shiro.AbstractRealm;
import com.pmease.commons.util.ClassUtils;
import com.pmease.gitplex.core.listeners.ConfigListener;
+import com.pmease.gitplex.core.listeners.DepotListener;
import com.pmease.gitplex.core.listeners.LifecycleListener;
import com.pmease.gitplex.core.listeners.PullRequestListener;
import com.pmease.gitplex.core.listeners.RefListener;
-import com.pmease.gitplex.core.listeners.DepotListener;
import com.pmease.gitplex.core.manager.AuthorizationManager;
import com.pmease.gitplex.core.manager.AuxiliaryManager;
import com.pmease.gitplex.core.manager.BranchWatchManager;
@@ -30,12 +30,12 @@ import com.pmease.gitplex.core.manager.CommentManager;
import com.pmease.gitplex.core.manager.CommentReplyManager;
import com.pmease.gitplex.core.manager.ConfigManager;
import com.pmease.gitplex.core.manager.DataManager;
+import com.pmease.gitplex.core.manager.DepotManager;
import com.pmease.gitplex.core.manager.MailManager;
import com.pmease.gitplex.core.manager.NotificationManager;
import com.pmease.gitplex.core.manager.PullRequestManager;
import com.pmease.gitplex.core.manager.PullRequestUpdateManager;
import com.pmease.gitplex.core.manager.PullRequestWatchManager;
-import com.pmease.gitplex.core.manager.DepotManager;
import com.pmease.gitplex.core.manager.ReviewInvitationManager;
import com.pmease.gitplex.core.manager.ReviewManager;
import com.pmease.gitplex.core.manager.SequentialWorkManager;
@@ -51,12 +51,12 @@ import com.pmease.gitplex.core.manager.impl.DefaultCommentManager;
import com.pmease.gitplex.core.manager.impl.DefaultCommentReplyManager;
import com.pmease.gitplex.core.manager.impl.DefaultConfigManager;
import com.pmease.gitplex.core.manager.impl.DefaultDataManager;
+import com.pmease.gitplex.core.manager.impl.DefaultDepotManager;
import com.pmease.gitplex.core.manager.impl.DefaultMailManager;
import com.pmease.gitplex.core.manager.impl.DefaultNotificationManager;
import com.pmease.gitplex.core.manager.impl.DefaultPullRequestManager;
import com.pmease.gitplex.core.manager.impl.DefaultPullRequestUpdateManager;
import com.pmease.gitplex.core.manager.impl.DefaultPullRequestWatchManager;
-import com.pmease.gitplex.core.manager.impl.DefaultDepotManager;
import com.pmease.gitplex.core.manager.impl.DefaultReviewInvitationManager;
import com.pmease.gitplex.core.manager.impl.DefaultReviewManager;
import com.pmease.gitplex.core.manager.impl.DefaultSequentialWorkManager;
@@ -83,7 +83,7 @@ public class CoreModule extends AbstractPluginModule {
protected void configure() {
super.configure();
- bind(NamingStrategy.class).toInstance(new PrefixedNamingStrategy("G"));
+ bind(PhysicalNamingStrategy.class).toInstance(new PrefixedNamingStrategy("G"));
contribute(ModelProvider.class, new ModelProvider() {
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/PullRequest.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/PullRequest.java
index 052618ff72..e156b0dfc6 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/PullRequest.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/PullRequest.java
@@ -17,17 +17,18 @@ import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
+import javax.persistence.Index;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
+import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.Version;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.annotations.DynamicUpdate;
-import org.hibernate.annotations.Index;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.annotations.OptimisticLock;
@@ -61,6 +62,7 @@ import com.pmease.gitplex.core.permission.ObjectPermission;
@SuppressWarnings("serial")
@Entity
@DynamicUpdate
+@Table(indexes={@Index(columnList="title"), @Index(columnList="idStr"), @Index(columnList="noSpaceTitle")})
public class PullRequest extends AbstractEntity {
public enum Status {
@@ -148,7 +150,6 @@ public class PullRequest extends AbstractEntity {
@Embedded
private CloseInfo closeInfo;
- @Index(name="PR_TITLE")
@Column(nullable=false)
private String title;
@@ -179,12 +180,10 @@ public class PullRequest extends AbstractEntity {
private User assignee;
// used for id search in markdown editor
- @Index(name="PR_ID_STR")
@Column(nullable=false)
private String idStr;
// used for title search in markdown editor
- @Index(name="PR_NO_SP_TITLE")
@Column(nullable=false)
private String noSpaceTitle;
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/ReviewInvitation.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/ReviewInvitation.java
index 9277d2b5d4..4b6baedd7d 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/ReviewInvitation.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/ReviewInvitation.java
@@ -1,67 +1,67 @@
-package com.pmease.gitplex.core.model;
-
-import java.util.Date;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.JoinColumn;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-
-import com.pmease.commons.hibernate.AbstractEntity;
-
-@SuppressWarnings("serial")
-@Entity
-@Table(uniqueConstraints={
- @UniqueConstraint(columnNames={"reviewer", "request"})
-})
-public class ReviewInvitation extends AbstractEntity {
-
- @ManyToOne(fetch=FetchType.LAZY)
- @JoinColumn(nullable=false)
- private User reviewer;
-
- @ManyToOne(fetch=FetchType.LAZY)
- @JoinColumn(nullable=false)
- private PullRequest request;
-
- private boolean perferred = true;
-
- @Column(nullable=false)
- private Date date = new Date();
-
- public User getReviewer() {
- return reviewer;
- }
-
- public void setReviewer(User reviewer) {
- this.reviewer = reviewer;
- }
-
- public PullRequest getRequest() {
- return request;
- }
-
- public void setRequest(PullRequest request) {
- this.request = request;
- }
-
- public boolean isPreferred() {
- return perferred;
- }
-
- public void setPerferred(boolean preferred) {
- this.perferred = preferred;
- }
-
- public Date getDate() {
- return date;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
-}
+package com.pmease.gitplex.core.model;
+
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+import javax.persistence.UniqueConstraint;
+
+import com.pmease.commons.hibernate.AbstractEntity;
+
+@SuppressWarnings("serial")
+@Entity
+@Table(uniqueConstraints={
+ @UniqueConstraint(columnNames={"reviewer", "request"})
+})
+public class ReviewInvitation extends AbstractEntity {
+
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(nullable=false)
+ private User reviewer;
+
+ @ManyToOne(fetch=FetchType.LAZY)
+ @JoinColumn(nullable=false)
+ private PullRequest request;
+
+ private boolean perferred = true;
+
+ @Column(nullable=false)
+ private Date date = new Date();
+
+ public User getReviewer() {
+ return reviewer;
+ }
+
+ public void setReviewer(User reviewer) {
+ this.reviewer = reviewer;
+ }
+
+ public PullRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(PullRequest request) {
+ this.request = request;
+ }
+
+ public boolean isPreferred() {
+ return perferred;
+ }
+
+ public void setPerferred(boolean preferred) {
+ this.perferred = preferred;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+}
diff --git a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/User.java b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/User.java
index 043300225e..a02cb45d77 100644
--- a/gitplex.core/src/main/java/com/pmease/gitplex/core/model/User.java
+++ b/gitplex.core/src/main/java/com/pmease/gitplex/core/model/User.java
@@ -6,12 +6,13 @@ import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.Index;
import javax.persistence.OneToMany;
+import javax.persistence.Table;
import org.eclipse.jgit.lib.PersonIdent;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
-import org.hibernate.annotations.Index;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.validator.constraints.Email;
@@ -29,24 +30,22 @@ import com.pmease.gitplex.core.util.validation.UserName;
@SuppressWarnings("serial")
@Entity
+@Table(indexes={@Index(columnList="email"), @Index(columnList="fullName"),
+ @Index(columnList="noSpaceName"), @Index(columnList="noSpaceFullName")})
@Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
@Editable
public class User extends AbstractUser implements ProtectedObject {
public static final Long ROOT_ID = 1L;
- @Index(name="USR_EMAIL")
@Column(nullable=false)
private String email;
- @Index(name="USR_FNAME")
private String fullName;
- @Index(name="USR_NOSP_NAME")
@Column(nullable=false)
private String noSpaceName;
- @Index(name="USR_NOSP_FNAME")
private String noSpaceFullName;
private Date avatarUploadDate;
diff --git a/gitplex.product/system/conf/hibernate.properties b/gitplex.product/system/conf/hibernate.properties
index 4c8780dcc9..a72848b8fc 100644
--- a/gitplex.product/system/conf/hibernate.properties
+++ b/gitplex.product/system/conf/hibernate.properties
@@ -1,116 +1,108 @@
-#----------------------------------------------------------------------------------
-# To use embedded HSQLDB database shipped with @productName@, please uncomment HSQLDB
-# database settings below and comment out settings for other databases.
-#----------------------------------------------------------------------------------
-
-hibernate.dialect=org.hibernate.dialect.HSQLDialect
-hibernate.connection.driver_class=org.hsqldb.jdbcDriver
-hibernate.connection.url=jdbc:hsqldb:file:${installDir}/sampledb/@dbName@;shutdown=true
-hibernate.connection.username=sa
-hibernate.connection.password=
-
-
-#----------------------------------------------------------------------------------
-# To use MySQL database, please follow these steps:
-# 1. Uncomment MySQL settings below and comment out settings for other databases.
-# 2. Create an empty @productName@ schema at MySQL side.
-# 3. Change the property "hibernate.connection.url", "hibernate.connection.username",
-# and "hibernate.connection.password" so that @productName@ can connect and write to
-# the database created in step 3.
-# 4. Make sure the default storage engine of the MySQL server is set to "innodb". On
-# Unix systems, this normally can be done by editing "/etc/my.cnf" and set entry
-# "default-storage-engine=innodb".
-# 5. After @productName@ starts up, checks the @productName@ schema with MySQL toosl to make
-# sure all tables are of innodb type.
-#----------------------------------------------------------------------------------
-
-#hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
-#hibernate.connection.driver_class=com.mysql.jdbc.Driver
-#hibernate.connection.url=jdbc:mysql://localhost:3306/@dbName@
-#hibernate.connection.username=root
-#hibernate.connection.password=root
-
-
-#----------------------------------------------------------------------------------
-# To use Microsoft SQL Server, please follow these steps:
-# 1. Enable tcp/ip access to SQL Server.
-# 2. Uncomment Microsoft SQL Server settings below and comment out settings for
-# other databases.
-# 3. Create an empty database at SQL Server side.
-# 4. Change the property "hibernate.connection.url", "hibernate.connection.username",
-# and "hibernate.connection.password" so that @productName@ can connect and write to
-# the database created in step 3.
-#----------------------------------------------------------------------------------
-
-#hibernate.dialect=org.hibernate.dialect.SQLServerDialect
-#hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
-#hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/@dbName@
-#hibernate.connection.username=sa
-#hibernate.connection.password=sa
-
-
-#----------------------------------------------------------------------------------
-# To use Oracle, please follow these steps:
-# 1. Download JDBC driver for your Oracle version from
-# "http://search.oracle.com/search/search?start=1&search_p_main_operator=all&q=jdbc+driver&group=Technology+Network".
-# Put the driver under the "lib" sub directory of
-# @productName@ server's installation directory.
-# 2. Uncomment Oracle settings below and comment out settings for other databases.
-# 3. Create an empty Oracle database.
-# 4. Change the property "hibernate.connection.url", "hibernate.connection.username",
-# and "hibernate.connection.password" so that @productName@ can connect and write to
-# the database created in step 3.
-# 5. Change property "hibernate.dialect" based on different Oracle versions:
-# 5.1 Use value "org.hibernate.dialect.Oracle9iDialect" if Oracle9i is used.
-# 5.2 Use value "org.hibernate.dialect.Oracle8iDialect" if Oracle8i is used.
-# 5.3 Use value "org.hibernate.dialect.Oracle10gDialect" if Oracle10g or 11g is
-# used.
-#----------------------------------------------------------------------------------
-
-#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
-#hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
-#hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:XE
-#hibernate.connection.username=ora
-#hibernate.connection.password=ora
-
-
-#----------------------------------------------------------------------------------
-# To use DB2, please follow these steps:
-# 1. Copy DB2 JDBC driver in DB2 distribution to
-# "<@productName@ server install dir>/lib". The driver
-# file is typically named "db2jcc.jar" and can normally be found in "java" sub
-# directory under DB2 server's installation directory.
-# 2. Uncomment DB2 settings below and comment out settings for other databases.
-# 3. Create an empty DB2 database with page size set to at least 16k.
-# 4. Change the property "hibernate.connection.url", "hibernate.connection.username",
-# and "hibernate.connection.password" so that @productName@ can connect and write to
-# the database created in step 3.
-#----------------------------------------------------------------------------------
-
-#hibernate.dialect=org.hibernate.dialect.DB2Dialect
-#hibernate.connection.driver_class=com.ibm.db2.jcc.DB2Driver
-#hibernate.connection.url=jdbc:db2://localhost:50000/@dbName@
-#hibernate.connection.username=db2
-#hibernate.connection.password=db2
-
-hibernate.connection.provider_class=com.jolbox.bonecp.provider.BoneCPConnectionProvider
-
-bonecp.idleMaxAgeInMinutes=240
-bonecp.idleConnectionTestPeriodInMinutes=60
-bonecp.partitionCount=3
-bonecp.acquireIncrement=5
-bonecp.maxConnectionsPerPartition=10
-bonecp.minConnectionsPerPartition=5
-bonecp.statementsCacheSize=50
-
-hibernate.connection.autocommit=true
-hibernate.show_sql=false
-hibernate.format_sql=true
-hibernate.use_sql_comments=true
-
-javax.persistence.validation.mode=none
-hibernate.validator.apply_to_ddl=false
-hibernate.hbm2ddl.auto=update
-
-hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
-hibernate.cache.use_query_cache=true
+#----------------------------------------------------------------------------------
+# To use embedded HSQLDB database shipped with @productName@, please uncomment HSQLDB
+# database settings below and comment out settings for other databases.
+#----------------------------------------------------------------------------------
+
+hibernate.dialect=org.hibernate.dialect.HSQLDialect
+hibernate.connection.driver_class=org.hsqldb.jdbcDriver
+hibernate.connection.url=jdbc:hsqldb:file:${installDir}/sampledb/@dbName@;shutdown=true
+hibernate.connection.username=sa
+hibernate.connection.password=
+
+
+#----------------------------------------------------------------------------------
+# To use MySQL database, please follow these steps:
+# 1. Uncomment MySQL settings below and comment out settings for other databases.
+# 2. Create an empty @productName@ schema at MySQL side.
+# 3. Change the property "hibernate.connection.url", "hibernate.connection.username",
+# and "hibernate.connection.password" so that @productName@ can connect and write to
+# the database created in step 3.
+# 4. Make sure the default storage engine of the MySQL server is set to "innodb". On
+# Unix systems, this normally can be done by editing "/etc/my.cnf" and set entry
+# "default-storage-engine=innodb".
+# 5. After @productName@ starts up, checks the @productName@ schema with MySQL toosl to make
+# sure all tables are of innodb type.
+#----------------------------------------------------------------------------------
+
+#hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
+#hibernate.connection.driver_class=com.mysql.jdbc.Driver
+#hibernate.connection.url=jdbc:mysql://localhost:3306/@dbName@
+#hibernate.connection.username=root
+#hibernate.connection.password=root
+
+
+#----------------------------------------------------------------------------------
+# To use Microsoft SQL Server, please follow these steps:
+# 1. Enable tcp/ip access to SQL Server.
+# 2. Uncomment Microsoft SQL Server settings below and comment out settings for
+# other databases.
+# 3. Create an empty database at SQL Server side.
+# 4. Change the property "hibernate.connection.url", "hibernate.connection.username",
+# and "hibernate.connection.password" so that @productName@ can connect and write to
+# the database created in step 3.
+#----------------------------------------------------------------------------------
+
+#hibernate.dialect=org.hibernate.dialect.SQLServerDialect
+#hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
+#hibernate.connection.url=jdbc:jtds:sqlserver://localhost:1433/@dbName@
+#hibernate.connection.username=sa
+#hibernate.connection.password=sa
+
+
+#----------------------------------------------------------------------------------
+# To use Oracle, please follow these steps:
+# 1. Download JDBC driver for your Oracle version from
+# "http://search.oracle.com/search/search?start=1&search_p_main_operator=all&q=jdbc+driver&group=Technology+Network".
+# Put the driver under the "lib" sub directory of
+# @productName@ server's installation directory.
+# 2. Uncomment Oracle settings below and comment out settings for other databases.
+# 3. Create an empty Oracle database.
+# 4. Change the property "hibernate.connection.url", "hibernate.connection.username",
+# and "hibernate.connection.password" so that @productName@ can connect and write to
+# the database created in step 3.
+# 5. Change property "hibernate.dialect" based on different Oracle versions:
+# 5.1 Use value "org.hibernate.dialect.Oracle9iDialect" if Oracle9i is used.
+# 5.2 Use value "org.hibernate.dialect.Oracle8iDialect" if Oracle8i is used.
+# 5.3 Use value "org.hibernate.dialect.Oracle10gDialect" if Oracle10g or 11g is
+# used.
+#----------------------------------------------------------------------------------
+
+#hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
+#hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
+#hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:XE
+#hibernate.connection.username=ora
+#hibernate.connection.password=ora
+
+
+#----------------------------------------------------------------------------------
+# To use DB2, please follow these steps:
+# 1. Copy DB2 JDBC driver in DB2 distribution to
+# "<@productName@ server install dir>/lib". The driver
+# file is typically named "db2jcc.jar" and can normally be found in "java" sub
+# directory under DB2 server's installation directory.
+# 2. Uncomment DB2 settings below and comment out settings for other databases.
+# 3. Create an empty DB2 database with page size set to at least 16k.
+# 4. Change the property "hibernate.connection.url", "hibernate.connection.username",
+# and "hibernate.connection.password" so that @productName@ can connect and write to
+# the database created in step 3.
+#----------------------------------------------------------------------------------
+
+#hibernate.dialect=org.hibernate.dialect.DB2Dialect
+#hibernate.connection.driver_class=com.ibm.db2.jcc.DB2Driver
+#hibernate.connection.url=jdbc:db2://localhost:50000/@dbName@
+#hibernate.connection.username=db2
+#hibernate.connection.password=db2
+
+hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider
+
+hibernate.connection.autocommit=true
+hibernate.show_sql=false
+hibernate.format_sql=true
+hibernate.use_sql_comments=true
+
+javax.persistence.validation.mode=none
+hibernate.validator.apply_to_ddl=false
+hibernate.hbm2ddl.auto=update
+
+hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
+hibernate.cache.use_query_cache=true
diff --git a/parent.general/pom.xml b/parent.general/pom.xml
index 074e76bb41..cae3e98b35 100644
--- a/parent.general/pom.xml
+++ b/parent.general/pom.xml
@@ -381,7 +381,12 @@
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
- <version>3.18.0-GA</version>
+ <version>3.20.0-GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.8</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
@@ -461,7 +466,7 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
- <version>5.1.0.Final</version>
+ <version>5.2.4.Final</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>