Browse Source

Pull request #5729: REPORT-70827 & REPORT-70810 兼容性问题2

Merge in CORE/base-third from ~RINOUX/base-third:release/11.0 to release/11.0

* commit '0eacb5ae5ef964f5cf65954965f6cd74c03f4054':
  REPORT-70827 & REPORT-70810 兼容性问题2
  REPORT-70827 & REPORT-70810 兼容性问题2
bugfix/KERNEL-11409-jackson
rinoux 3 years ago
parent
commit
f3dab7c25e
  1. 14
      fine-druid/src/main/java/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java
  2. 2
      fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java
  3. 6
      fine-druid/src/main/java/com/fr/third/alibaba/druid/util/Utils.java

14
fine-druid/src/main/java/com/fr/third/alibaba/druid/support/hibernate/DruidConnectionProvider.java

@ -18,13 +18,11 @@ package com.fr.third.alibaba.druid.support.hibernate;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Map;
import java.util.Properties;
import com.fr.third.alibaba.druid.pool.DruidDataSource;
import com.fr.third.alibaba.druid.pool.DruidDataSourceFactory;
import com.fr.third.org.hibernate.HibernateException;
import com.fr.third.org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import com.fr.third.org.hibernate.exception.spi.Configurable;
import com.fr.third.org.hibernate.service.spi.Configurable;
import com.fr.third.org.hibernate.service.spi.Stoppable;
public class DruidConnectionProvider implements ConnectionProvider, Configurable, Stoppable {
@ -64,7 +62,7 @@ public class DruidConnectionProvider implements ConnectionProvider, Configurable
}
@SuppressWarnings("rawtypes")
//@Override
@Override
public void configure(Map configurationValues) {
try {
DruidDataSourceFactory.config(dataSource, configurationValues);
@ -78,12 +76,4 @@ public class DruidConnectionProvider implements ConnectionProvider, Configurable
dataSource.close();
}
@Override
public void configure(Properties properties) throws HibernateException {
try {
DruidDataSourceFactory.config(dataSource, properties);
} catch (SQLException e) {
throw new IllegalArgumentException("config error", e);
}
}
}

2
fine-druid/src/main/java/com/fr/third/alibaba/druid/util/MySqlUtils.java

@ -415,7 +415,7 @@ public class MySqlUtils {
if (cc.class_connectionImpl == null && !cc.class_connectionImpl_Error) {
try {
cc.class_connectionImpl = Utils.loadClass("com.mysql.jdbc.MySQLConnection");
if (cc.class_connectionImpl == null) {
if (cc.class_connectionImpl == null || cc.class_connectionImpl.getClassLoader() != cl) {
cc.class_connectionImpl = Utils.loadClass("com.mysql.cj.MysqlConnection");
if (cc.class_connectionImpl != null) {
cc.mysqlJdbcVersion6 = true;

6
fine-druid/src/main/java/com/fr/third/alibaba/druid/util/Utils.java

@ -252,6 +252,12 @@ public class Utils {
// skip
}
try {
return ClassLoaderFactory.loadClass(className);
} catch (ClassNotFoundException e) {
//
}
return null;
}

Loading…
Cancel
Save