HHH-6335 : Change PojoEntitySpecifics to use JavaType for entity and proxy classes
This commit is contained in:
parent
86e98b2432
commit
2129f94aa3
|
@ -24,6 +24,7 @@
|
||||||
package org.hibernate.metamodel.domain;
|
package org.hibernate.metamodel.domain;
|
||||||
|
|
||||||
import org.hibernate.EntityMode;
|
import org.hibernate.EntityMode;
|
||||||
|
import org.hibernate.service.classloading.spi.ClassLoaderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Models the notion of an entity
|
* Models the notion of an entity
|
||||||
|
@ -68,8 +69,8 @@ public class Entity extends AbstractAttributeContainer {
|
||||||
|
|
||||||
public static class PojoEntitySpecifics implements EntityModeEntitySpecifics {
|
public static class PojoEntitySpecifics implements EntityModeEntitySpecifics {
|
||||||
private String tuplizerClassName;
|
private String tuplizerClassName;
|
||||||
private String className;
|
private JavaType entityClass;
|
||||||
private String proxyInterfaceName;
|
private JavaType proxyInterface;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EntityMode getEntityMode() {
|
public EntityMode getEntityMode() {
|
||||||
|
@ -85,19 +86,27 @@ public class Entity extends AbstractAttributeContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClassName() {
|
public String getClassName() {
|
||||||
return className;
|
return entityClass.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setClassName(String className) {
|
public void setClassName(String className, ClassLoaderService classLoaderService) {
|
||||||
this.className = className;
|
this.entityClass = new JavaType( className, classLoaderService );
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<?> getEntityClass() {
|
||||||
|
return entityClass.getClassReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProxyInterfaceName() {
|
public String getProxyInterfaceName() {
|
||||||
return proxyInterfaceName;
|
return proxyInterface.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProxyInterfaceName(String proxyInterfaceName) {
|
public void setProxyInterfaceName(String proxyInterfaceName, ClassLoaderService classLoaderService) {
|
||||||
this.proxyInterfaceName = proxyInterfaceName;
|
this.proxyInterface = new JavaType( proxyInterfaceName, classLoaderService );
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<?> getProxyInterfaceClass() {
|
||||||
|
return proxyInterface.getClassReference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,7 @@ import org.hibernate.metamodel.binding.state.SimpleAttributeBindingState;
|
||||||
import org.hibernate.metamodel.relational.state.TupleRelationalState;
|
import org.hibernate.metamodel.relational.state.TupleRelationalState;
|
||||||
import org.hibernate.metamodel.relational.state.ValueRelationalState;
|
import org.hibernate.metamodel.relational.state.ValueRelationalState;
|
||||||
import org.hibernate.metamodel.source.spi.MetadataImplementor;
|
import org.hibernate.metamodel.source.spi.MetadataImplementor;
|
||||||
|
import org.hibernate.service.classloading.spi.ClassLoaderService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO : javadoc
|
* TODO : javadoc
|
||||||
|
@ -154,14 +155,17 @@ abstract class AbstractEntityBinder {
|
||||||
String className = bindingContext.getClassName( entityClazz.getName() );
|
String className = bindingContext.getClassName( entityClazz.getName() );
|
||||||
String proxyName = entityBinding.getProxyInterfaceName();
|
String proxyName = entityBinding.getProxyInterfaceName();
|
||||||
|
|
||||||
entityBinding.getEntity().getPojoEntitySpecifics().setClassName( className );
|
final ClassLoaderService classLoaderService =
|
||||||
|
bindingContext.getServiceRegistry().getService( ClassLoaderService.class );
|
||||||
|
|
||||||
|
entityBinding.getEntity().getPojoEntitySpecifics().setClassName( className, classLoaderService );
|
||||||
|
|
||||||
if ( proxyName != null ) {
|
if ( proxyName != null ) {
|
||||||
entityBinding.getEntity().getPojoEntitySpecifics().setProxyInterfaceName( proxyName );
|
entityBinding.getEntity().getPojoEntitySpecifics().setProxyInterfaceName( proxyName, classLoaderService );
|
||||||
entityBinding.setLazy( true );
|
entityBinding.setLazy( true );
|
||||||
}
|
}
|
||||||
else if ( entityBinding.isLazy() ) {
|
else if ( entityBinding.isLazy() ) {
|
||||||
entityBinding.getEntity().getPojoEntitySpecifics().setProxyInterfaceName( className );
|
entityBinding.getEntity().getPojoEntitySpecifics().setProxyInterfaceName( className, classLoaderService );
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLTuplizerElement tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.POJO );
|
XMLTuplizerElement tuplizer = locateTuplizerDefinition( entityClazz, EntityMode.POJO );
|
||||||
|
|
Loading…
Reference in New Issue