Browse Source

MOBILE-17909&MOBILE-17908 10.0微信》定时调度有微信任务时卸载微信插件,报错

10.0
zed 6 years ago
parent
commit
da0a9c47b2
  1. 7
      fine-hibernate/src/com/fr/third/org/hibernate/tuple/PojoInstantiator.java
  2. 41
      fine-hibernate/src/com/fr/third/org/hibernate/tuple/entity/DefaultEntityRegister.java

7
fine-hibernate/src/com/fr/third/org/hibernate/tuple/PojoInstantiator.java

@ -17,6 +17,7 @@ import com.fr.third.org.hibernate.internal.CoreLogging;
import com.fr.third.org.hibernate.internal.CoreMessageLogger;
import com.fr.third.org.hibernate.internal.util.ReflectHelper;
import com.fr.third.org.hibernate.mapping.Component;
import com.fr.third.org.hibernate.tuple.entity.DefaultEntityRegister;
/**
* Defines a POJO-based instantiator for use from the tuplizers.
@ -72,7 +73,11 @@ public class PojoInstantiator implements Instantiator, Serializable {
public Object instantiate() {
if ( isAbstract ) {
throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass );
try {
return DefaultEntityRegister.getInstance().getDefaultEntityClass().newInstance();
} catch (Exception e) {
throw new InstantiationException("class not found: ", mappedClass);
}
}
else if ( optimizer != null ) {
return optimizer.newInstance();

41
fine-hibernate/src/com/fr/third/org/hibernate/tuple/entity/DefaultEntityRegister.java

@ -0,0 +1,41 @@
package com.fr.third.org.hibernate.tuple.entity;
/**
* Created by Zed on 2018/11/1.
*/
public class DefaultEntityRegister {
private static volatile DefaultEntityRegister instance;
private Class defaultEntityClass = null;
public static DefaultEntityRegister getInstance() {
if (instance == null) {
synchronized (DefaultEntityRegister.class) {
if (instance == null) {
instance = new DefaultEntityRegister();
}
}
}
return instance;
}
private DefaultEntityRegister() {
}
public void registerDefaultClass(Class defaultEntityClass) {
this.defaultEntityClass = defaultEntityClass;
}
public void resetDefaultClass() {
this.defaultEntityClass = null;
}
public Class getDefaultEntityClass() {
return defaultEntityClass;
}
public void setDefaultEntityClass(Class defaultEntityClass) {
this.defaultEntityClass = defaultEntityClass;
}
}
Loading…
Cancel
Save