HHH-6371 - Develop metamodel binding creation using a push approach

This commit is contained in:
Steve Ebersole 2011-07-06 04:44:58 -05:00
parent 66bd796063
commit 9e95d41689
24 changed files with 698 additions and 411 deletions

View File

@ -61,6 +61,8 @@ libraries = [
// Dom4J
dom4j: 'dom4j:dom4j:1.6.1@jar',
jaxb: 'com.sun.xml.bind:jaxb-xjc:2.1.6',
jaxb2_basics: 'org.jvnet.jaxb2_commons:jaxb2-basics:0.6.0',
jaxb2_ant: 'org.jvnet.jaxb2_commons:jaxb2-basics-ant:0.6.0',
// h2
h2: 'com.h2database:h2:1.2.145',
@ -141,6 +143,8 @@ subprojects { subProject ->
jbossLoggingTool( libraries.logging_tools )
hibernateJpaModelGenTool( libraries.jpa_modelgen )
jaxb( libraries.jaxb )
jaxb( libraries.jaxb2_basics )
jaxb( libraries.jaxb2_ant )
deployerJars "org.apache.maven.wagon:wagon-http:1.0-beta-6"
}

View File

@ -57,15 +57,20 @@ task jaxb {
hbmXsd = file( 'src/main/resources/org/hibernate/hibernate-mapping-4.0.xsd' )
ormXsd = file( 'src/main/resources/org/hibernate/ejb/orm_2_0.xsd' )
// input bindings
cfgXjb = file( 'src/main/xjb/hbm-configuration-bindings.xjb' )
hbmXjb = file( 'src/main/xjb/hbm-mapping-bindings.xjb' )
ormXjb = file( 'src/main/xjb/orm-bindings.xjb' )
// configure Gradle up-to-date checking
inputs.files( [cfgXsd, hbmXsd, ormXsd] )
inputs.files( [cfgXsd, hbmXsd, ormXsd, cfgXjb, hbmXjb, ormXjb] )
outputs.dir( jaxbTargetDir )
// perform actions
doLast {
jaxbTargetDir.mkdirs()
ant.taskdef(name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask', classpath: configurations.jaxb.asPath)
ant.taskdef(name: 'xjc', classname: 'org.jvnet.jaxb2_commons.xjc.XJC2Task', classpath: configurations.jaxb.asPath)
ant.jaxbTargetDir = jaxbTargetDir
// hibernate-configuration
@ -80,9 +85,12 @@ task jaxb {
ant.xjc(
destdir: '${jaxbTargetDir}',
package: 'org.hibernate.metamodel.source.hbm.xml.mapping',
binding: 'src/main/xjb/hbm-mapping-bindings.xjb',
schema: hbmXsd.path
)
binding: hbmXjb.path,
schema: hbmXsd.path,
extension: 'true'
) {
arg line: '-Xinheritance'
}
// orm.xml (jpa)
ant.xjc(

View File

@ -1,184 +0,0 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder;
import java.util.Map;
import org.hibernate.EntityMode;
import org.hibernate.metamodel.binder.source.BindingContext;
import org.hibernate.metamodel.binder.source.DiscriminatorSubClassEntityDescriptor;
import org.hibernate.metamodel.binder.source.EntityDescriptor;
import org.hibernate.metamodel.binder.source.JoinedSubClassEntityDescriptor;
import org.hibernate.metamodel.binder.source.RootEntityDescriptor;
import org.hibernate.metamodel.binder.source.UnionSubClassEntityDescriptor;
import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.binding.InheritanceType;
import org.hibernate.metamodel.domain.Entity;
import org.hibernate.metamodel.domain.JavaType;
/**
* @author Steve Ebersole
*/
public class EntityBinder {
// todo : re-purpose this as a general "metadata binder" with public apis to handle all the specific bindings?
// todo : make this globally available from MetadataImpl
private final BindingContext bindingContext;
public EntityBinder(BindingContext bindingContext) {
this.bindingContext = bindingContext;
}
public EntityBinding createEntityBinding(EntityDescriptor entityDescriptor) {
final InheritanceType inheritanceType = entityDescriptor.getEntityInheritanceType();
if ( inheritanceType == InheritanceType.NO_INHERITANCE ) {
// root, also doubles as a type check since the cast would fail
return makeEntityBinding( (RootEntityDescriptor) entityDescriptor );
}
else {
if ( entityDescriptor.getSuperEntityName() == null ) {
throw new MappingException(
"Encountered inheritance strategy, but no super type found",
entityDescriptor.getOrigin()
);
}
if ( inheritanceType == InheritanceType.SINGLE_TABLE ) {
// discriminator subclassing
return makeEntityBinding( (DiscriminatorSubClassEntityDescriptor) entityDescriptor );
}
else if ( inheritanceType == InheritanceType.JOINED ) {
// joined subclassing
return makeEntityBinding( (JoinedSubClassEntityDescriptor) entityDescriptor );
}
else if ( inheritanceType == InheritanceType.TABLE_PER_CLASS ) {
return makeEntityBinding( (UnionSubClassEntityDescriptor) entityDescriptor );
}
else {
throw new IllegalStateException( "Unexpected inheritance type [" + inheritanceType + "]" );
}
}
}
protected EntityBinding makeEntityBinding(RootEntityDescriptor entityDescriptor) {
final EntityBinding entityBinding = new EntityBinding();
final Entity entity = new Entity( entityDescriptor.getEntityName(), null, bindingContext.makeJavaType( entityDescriptor.getClassName() ) );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, entityDescriptor );
entityBinding.setMutable( entityDescriptor.isMutable() );
entityBinding.setExplicitPolymorphism( entityDescriptor.isExplicitPolymorphism() );
entityBinding.setWhereFilter( entityDescriptor.getWhereFilter() );
entityBinding.setRowId( entityDescriptor.getRowId() );
entityBinding.setOptimisticLockStyle( entityDescriptor.getOptimisticLockStyle() );
entityBinding.setCaching( entityDescriptor.getCaching() );
return entityBinding;
}
protected EntityBinding makeEntityBinding(DiscriminatorSubClassEntityDescriptor entityDescriptor) {
// temporary!!!
final EntityBinding entityBinding = new EntityBinding();
final Entity entity = new Entity( entityDescriptor.getEntityName(), null, bindingContext.makeJavaType( entityDescriptor.getClassName() ) );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, entityDescriptor );
return entityBinding;
}
protected EntityBinding makeEntityBinding(JoinedSubClassEntityDescriptor entityDescriptor) {
// temporary!!!
final EntityBinding entityBinding = new EntityBinding();
final Entity entity = new Entity( entityDescriptor.getEntityName(), null, bindingContext.makeJavaType( entityDescriptor.getClassName() ) );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, entityDescriptor );
return entityBinding;
}
protected EntityBinding makeEntityBinding(UnionSubClassEntityDescriptor entityDescriptor) {
// temporary!!!
final EntityBinding entityBinding = new EntityBinding();
final Entity entity = new Entity( entityDescriptor.getEntityName(), null, bindingContext.makeJavaType( entityDescriptor.getClassName() ) );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, entityDescriptor );
return entityBinding;
}
protected void performBasicEntityBind(EntityBinding entityBinding, EntityDescriptor entityDescriptor) {
entityBinding.setInheritanceType( entityDescriptor.getEntityInheritanceType() );
entityBinding.setJpaEntityName( entityDescriptor.getJpaEntityName() );
entityBinding.setEntityMode( entityDescriptor.getEntityMode() );
if ( entityDescriptor.getEntityMode() == EntityMode.POJO ) {
if ( entityDescriptor.getProxyInterfaceName() != null ) {
entityBinding.setProxyInterfaceType( bindingContext.makeJavaType( entityDescriptor.getProxyInterfaceName() ) );
entityBinding.setLazy( true );
}
else if ( entityDescriptor.isLazy() ) {
entityBinding.setProxyInterfaceType( entityBinding.getEntity().getJavaType() );
entityBinding.setLazy( true );
}
}
else {
entityBinding.setProxyInterfaceType( new JavaType( Map.class ) );
entityBinding.setLazy( entityDescriptor.isLazy() );
}
entityBinding.setCustomEntityTuplizerClass( entityDescriptor.getCustomEntityTuplizerClass() );
entityBinding.setCustomEntityPersisterClass( entityDescriptor.getCustomEntityPersisterClass() );
entityBinding.setMetaAttributeContext( entityDescriptor.getMetaAttributeContext() );
entityBinding.setDynamicUpdate( entityDescriptor.isDynamicUpdate() );
entityBinding.setDynamicInsert( entityDescriptor.isDynamicInsert() );
entityBinding.setBatchSize( entityDescriptor.getBatchSize() );
entityBinding.setSelectBeforeUpdate( entityDescriptor.isSelectBeforeUpdate() );
entityBinding.setAbstract( entityDescriptor.isAbstract() );
entityBinding.setCustomLoaderName( entityDescriptor.getCustomLoaderName() );
entityBinding.setCustomInsert( entityDescriptor.getCustomInsert() );
entityBinding.setCustomUpdate( entityDescriptor.getCustomUpdate() );
entityBinding.setCustomDelete( entityDescriptor.getCustomDelete() );
if ( entityDescriptor.getSynchronizedTableNames() != null ) {
entityBinding.addSynchronizedTableNames( entityDescriptor.getSynchronizedTableNames() );
}
}
}

View File

@ -24,6 +24,7 @@
package org.hibernate.metamodel.binder.source;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.domain.JavaType;
import org.hibernate.service.ServiceRegistry;
@ -44,4 +45,6 @@ public interface BindingContext {
public JavaType makeJavaType(String className);
public boolean isGloballyQuotedIdentifiers();
public Value<Class<?>> makeClassReference(String className);
}

View File

@ -30,6 +30,7 @@ import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.Index;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.binder.MappingException;
import org.hibernate.metamodel.binder.source.EntityDescriptor;
import org.hibernate.metamodel.binder.source.MappingDefaults;
@ -154,4 +155,9 @@ public class AnnotationsMetadataProcessor implements AnnotationsBindingContext {
public JavaType makeJavaType(String className) {
return parentBindingContext.makeJavaType( className );
}
@Override
public Value<Class<?>> makeClassReference(String className) {
return parentBindingContext.makeClassReference( className );
}
}

View File

@ -286,6 +286,11 @@ public class AnnotationsSourceProcessor implements SourceProcessor, AnnotationsB
}
return javaType;
}
@Override
public Value<Class<?>> makeClassReference(String className) {
return new Value<Class<?>>( locateClassByName( className ) );
}
}

View File

@ -99,7 +99,7 @@ public abstract class AbstractEntityDescriptorImpl implements EntityDescriptor {
this.entityMode = verbatimClassName == null ? EntityMode.MAP : EntityMode.POJO;
if ( this.entityMode == EntityMode.POJO ) {
this.className = bindingContext.getClassName( verbatimClassName );
this.className = bindingContext.qualifyClassName( verbatimClassName );
this.proxyInterfaceName = entityClazz.getProxy();
}
else {

View File

@ -0,0 +1,342 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.hbm;
import java.util.Map;
import org.hibernate.EntityMode;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.engine.OptimisticLockStyle;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.binder.MappingException;
import org.hibernate.metamodel.binder.source.hbm.xml.mapping.EntityElement;
import org.hibernate.metamodel.binder.source.hbm.xml.mapping.SubclassEntityElement;
import org.hibernate.metamodel.binding.Caching;
import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.binding.InheritanceType;
import org.hibernate.metamodel.domain.Entity;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLCacheElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLJoinedSubclassElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlDeleteElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlInsertElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSqlUpdateElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSubclassElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSynchronizeElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLTuplizerElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLUnionSubclassElement;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.tuple.entity.EntityTuplizer;
/**
* @author Steve Ebersole
*/
public class BindingCreator {
private final HbmBindingContext bindingContext;
public BindingCreator(HbmBindingContext bindingContext) {
this.bindingContext = bindingContext;
}
public EntityBinding createEntityBinding(EntityElement entityElement, String containingSuperEntityName) {
if ( XMLHibernateMapping.XMLClass.class.isInstance( entityElement ) ) {
return makeEntityBinding( (XMLHibernateMapping.XMLClass) entityElement );
}
else {
String superEntityName = containingSuperEntityName;
if ( superEntityName == null ) {
final SubclassEntityElement subclass = (SubclassEntityElement) entityElement;
superEntityName = bindingContext.qualifyClassName( subclass.getExtends() );
}
if ( superEntityName == null) {
throw new MappingException(
"Encountered inheritance strategy, but no super type found",
bindingContext.getOrigin()
);
}
if ( XMLSubclassElement.class.isInstance( entityElement ) ) {
return makeEntityBinding( (XMLSubclassElement) entityElement, superEntityName );
}
else if ( XMLJoinedSubclassElement.class.isInstance( entityElement ) ) {
return makeEntityBinding( (XMLJoinedSubclassElement) entityElement, superEntityName );
}
else if ( XMLUnionSubclassElement.class.isInstance( entityElement ) ) {
return makeEntityBinding( (XMLUnionSubclassElement) entityElement, superEntityName );
}
else {
throw new MappingException(
"unknown type of class or subclass: " + entityElement.getClass().getName(),
bindingContext.getOrigin()
);
}
}
}
protected EntityBinding makeEntityBinding(XMLHibernateMapping.XMLClass xmlClass) {
final EntityBinding entityBinding = new EntityBinding();
entityBinding.setInheritanceType( InheritanceType.NO_INHERITANCE );
final String entityName = bindingContext.determineEntityName( xmlClass );
final String verbatimClassName = xmlClass.getName();
final EntityMode entityMode = verbatimClassName == null ? EntityMode.MAP : EntityMode.POJO;
entityBinding.setEntityMode( entityMode );
final String className;
if ( entityMode == EntityMode.POJO ) {
className = bindingContext.qualifyClassName( verbatimClassName );
}
else {
className = null;
}
Entity entity = new Entity( entityName, className, bindingContext.makeClassReference( className ), null );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, xmlClass );
entityBinding.setMutable( xmlClass.isMutable() );
entityBinding.setExplicitPolymorphism( "explicit".equals( xmlClass.getPolymorphism() ) );
entityBinding.setWhereFilter( xmlClass.getWhere() );
entityBinding.setRowId( xmlClass.getRowid() );
entityBinding.setOptimisticLockStyle( interpretOptimisticLockStyle( xmlClass ) );
entityBinding.setCaching( interpretCaching( xmlClass, entityName ) );
return entityBinding;
}
private static Caching interpretCaching(XMLHibernateMapping.XMLClass xmlClass, String entityName) {
final XMLCacheElement cache = xmlClass.getCache();
if ( cache == null ) {
return null;
}
final String region = cache.getRegion() != null ? cache.getRegion() : entityName;
final AccessType accessType = Enum.valueOf( AccessType.class, cache.getUsage() );
final boolean cacheLazyProps = !"non-lazy".equals( cache.getInclude() );
return new Caching( region, accessType, cacheLazyProps );
}
private OptimisticLockStyle interpretOptimisticLockStyle(XMLHibernateMapping.XMLClass entityClazz) {
final String optimisticLockModeString = MappingHelper.getStringValue(
entityClazz.getOptimisticLock(),
"version"
);
try {
return OptimisticLockStyle.valueOf( optimisticLockModeString.toUpperCase() );
}
catch (Exception e) {
throw new MappingException(
"Unknown optimistic-lock value : " + optimisticLockModeString,
bindingContext.getOrigin()
);
}
}
protected EntityBinding makeEntityBinding(XMLSubclassElement subclassElement, String superEntityName) {
// temporary!!!
final EntityBinding entityBinding = new EntityBinding();
entityBinding.setInheritanceType( InheritanceType.SINGLE_TABLE );
final String entityName = bindingContext.determineEntityName( subclassElement );
final String verbatimClassName = subclassElement.getName();
final EntityMode entityMode = verbatimClassName == null ? EntityMode.MAP : EntityMode.POJO;
entityBinding.setEntityMode( entityMode );
final String className;
if ( entityMode == EntityMode.POJO ) {
className = bindingContext.qualifyClassName( verbatimClassName );
}
else {
className = null;
}
final Entity entity = new Entity( entityName, className, bindingContext.makeClassReference( className ), null );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, subclassElement );
return entityBinding;
}
protected EntityBinding makeEntityBinding(XMLJoinedSubclassElement joinedEntityElement, String superEntityName) {
// temporary!!!
final EntityBinding entityBinding = new EntityBinding();
entityBinding.setInheritanceType( InheritanceType.JOINED );
final String entityName = bindingContext.determineEntityName( joinedEntityElement );
final String verbatimClassName = joinedEntityElement.getName();
final EntityMode entityMode = verbatimClassName == null ? EntityMode.MAP : EntityMode.POJO;
entityBinding.setEntityMode( entityMode );
final String className;
if ( entityMode == EntityMode.POJO ) {
className = bindingContext.qualifyClassName( verbatimClassName );
}
else {
className = null;
}
final Entity entity = new Entity( entityName, className, bindingContext.makeClassReference( className ), null );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, joinedEntityElement );
return entityBinding;
}
protected EntityBinding makeEntityBinding(XMLUnionSubclassElement unionEntityElement, String superEntityName) {
// temporary!!!
final EntityBinding entityBinding = new EntityBinding();
entityBinding.setInheritanceType( InheritanceType.TABLE_PER_CLASS );
final String entityName = bindingContext.determineEntityName( unionEntityElement );
final String verbatimClassName = unionEntityElement.getName();
final EntityMode entityMode = verbatimClassName == null ? EntityMode.MAP : EntityMode.POJO;
entityBinding.setEntityMode( entityMode );
final String className;
if ( entityMode == EntityMode.POJO ) {
className = bindingContext.qualifyClassName( verbatimClassName );
}
else {
className = null;
}
final Entity entity = new Entity( entityName, className, bindingContext.makeClassReference( className ), null );
entityBinding.setEntity( entity );
performBasicEntityBind( entityBinding, unionEntityElement );
return entityBinding;
}
@SuppressWarnings( {"unchecked"})
protected void performBasicEntityBind(EntityBinding entityBinding, EntityElement entityElement) {
entityBinding.setJpaEntityName( null );
final String proxy = entityElement.getProxy();
final Boolean isLazy = entityElement.isLazy();
if ( entityBinding.getEntityMode() == EntityMode.POJO ) {
if ( proxy != null ) {
entityBinding.setProxyInterfaceType( bindingContext.makeClassReference(
bindingContext.qualifyClassName(
proxy
)
) );
entityBinding.setLazy( true );
}
else if ( isLazy ) {
entityBinding.setProxyInterfaceType( entityBinding.getEntity().getClassReferenceUnresolved() );
entityBinding.setLazy( true );
}
}
else {
entityBinding.setProxyInterfaceType( new Value( Map.class ) );
entityBinding.setLazy( isLazy );
}
final String customTuplizerClassName = extractCustomTuplizerClassName( entityElement, entityBinding.getEntityMode() );
if ( customTuplizerClassName != null ) {
entityBinding.setCustomEntityTuplizerClass( bindingContext.<EntityTuplizer>locateClassByName( customTuplizerClassName ) );
}
if ( entityElement.getPersister() != null ) {
entityBinding.setCustomEntityPersisterClass( bindingContext.<EntityPersister>locateClassByName( entityElement.getPersister() ) );
}
entityBinding.setMetaAttributeContext(
HbmHelper.extractMetaAttributeContext(
entityElement.getMeta(), true, bindingContext.getMetaAttributeContext()
)
);
entityBinding.setDynamicUpdate( entityElement.isDynamicUpdate() );
entityBinding.setDynamicInsert( entityElement.isDynamicInsert() );
entityBinding.setBatchSize( MappingHelper.getIntValue( entityElement.getBatchSize(), 0 ) );
entityBinding.setSelectBeforeUpdate( entityElement.isSelectBeforeUpdate() );
entityBinding.setAbstract( entityElement.isAbstract() );
entityBinding.setCustomLoaderName( entityElement.getLoader().getQueryRef() );
final XMLSqlInsertElement sqlInsert = entityElement.getSqlInsert();
if ( sqlInsert != null ) {
entityBinding.setCustomInsert(
HbmHelper.getCustomSql(
sqlInsert.getValue(),
sqlInsert.isCallable(),
sqlInsert.getCheck().value()
)
);
}
final XMLSqlDeleteElement sqlDelete = entityElement.getSqlDelete();
if ( sqlDelete != null ) {
entityBinding.setCustomDelete(
HbmHelper.getCustomSql(
sqlDelete.getValue(),
sqlDelete.isCallable(),
sqlDelete.getCheck().value()
)
);
}
final XMLSqlUpdateElement sqlUpdate = entityElement.getSqlUpdate();
if ( sqlUpdate != null ) {
entityBinding.setCustomUpdate(
HbmHelper.getCustomSql(
sqlUpdate.getValue(),
sqlUpdate.isCallable(),
sqlUpdate.getCheck().value()
)
);
}
if ( entityElement.getSynchronize() != null ) {
for ( XMLSynchronizeElement synchronize : entityElement.getSynchronize() ) {
entityBinding.addSynchronizedTable( synchronize.getTable() );
}
}
}
private String extractCustomTuplizerClassName(EntityElement entityMapping, EntityMode entityMode) {
if ( entityMapping.getTuplizer() == null ) {
return null;
}
for ( XMLTuplizerElement tuplizerElement : entityMapping.getTuplizer() ) {
if ( entityMode == EntityMode.parse( tuplizerElement.getEntityMode() ) ) {
return tuplizerElement.getClazz();
}
}
return null;
}
}

View File

@ -45,7 +45,7 @@ public interface HbmBindingContext extends BindingContext {
public String determineEntityName(EntityElement entityElement);
public String getClassName(String unqualifiedName);
public String qualifyClassName(String unqualifiedName);
public void processFetchProfiles(List<XMLFetchProfileElement> fetchProfiles, String containingEntityName);
}

View File

@ -32,6 +32,7 @@ import java.util.Set;
import org.hibernate.MappingException;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.binder.source.BindingContext;
import org.hibernate.metamodel.binder.source.MappingDefaults;
@ -210,4 +211,9 @@ public class HbmSourceProcessorImpl implements SourceProcessor, BindingContext {
public JavaType makeJavaType(String className) {
return metadata.makeJavaType( className );
}
@Override
public Value<Class<?>> makeClassReference(String className) {
return metadata.makeClassReference( className );
}
}

View File

@ -33,10 +33,8 @@ import org.hibernate.cfg.NamingStrategy;
import org.hibernate.engine.spi.FilterDefinition;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.binder.EntityBinder;
import org.hibernate.metamodel.binder.MappingException;
import org.hibernate.metamodel.binder.Origin;
import org.hibernate.metamodel.binder.source.EntityDescriptor;
import org.hibernate.metamodel.binder.source.MappingDefaults;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
@ -79,7 +77,7 @@ public class HibernateMappingProcessor implements HbmBindingContext {
private final MetaAttributeContext metaAttributeContext;
private final EntityBinder entityBinder;
private final BindingCreator bindingCreator;
private final boolean autoImport;
@ -102,7 +100,7 @@ public class HibernateMappingProcessor implements HbmBindingContext {
this.autoImport = hibernateMapping.isAutoImport();
this.entityBinder = new EntityBinder( this );
this.bindingCreator = new BindingCreator( this );
this.metaAttributeContext = extractMetaAttributes();
}
@ -167,6 +165,11 @@ public class HibernateMappingProcessor implements HbmBindingContext {
return getMetadataImplementor().makeJavaType( className );
}
@Override
public Value<Class<?>> makeClassReference(String className) {
return getMetadataImplementor().makeClassReference( className );
}
public void processIndependentMetadata() {
processDatabaseObjectDefinitions();
processTypeDefinitions();
@ -289,37 +292,12 @@ public class HibernateMappingProcessor implements HbmBindingContext {
for ( Object entityElementO : hibernateMapping.getClazzOrSubclassOrJoinedSubclass() ) {
final EntityElement entityElement = (EntityElement) entityElementO;
// determine the type of root element we have and build appropriate entity descriptor. Might be:
// 1) <class/>
// 2) <subclass/>
// 3) <joined-subclass/>
// 4) <union-subclass/>
final EntityDescriptor entityDescriptor;
if ( XMLHibernateMapping.XMLClass.class.isInstance( entityElement ) ) {
entityDescriptor = new RootEntityDescriptorImpl( entityElement, this );
}
else if ( XMLSubclassElement.class.isInstance( entityElement ) ) {
entityDescriptor = new DiscriminatedSubClassEntityDescriptorImpl( entityElement, this );
}
else if ( XMLJoinedSubclassElement.class.isInstance( entityElement ) ) {
entityDescriptor = new JoinedSubClassEntityDescriptorImpl( entityElement, this );
}
else if ( XMLUnionSubclassElement.class.isInstance( entityElement ) ) {
entityDescriptor = new UnionSubClassEntityDescriptorImpl( entityElement, this );
}
else {
throw new MappingException(
"unknown type of class or subclass: " + entityElement.getClass().getName(),
jaxbRoot.getOrigin()
);
}
if ( processedEntityNames.contains( entityDescriptor.getEntityName() ) ) {
final String entityName = this.determineEntityName( entityElement );
if ( processedEntityNames.contains( entityName ) ) {
continue;
}
final EntityBinding entityBinding = entityBinder.createEntityBinding( entityDescriptor );
final EntityBinding entityBinding = bindingCreator.createEntityBinding( entityElement, null );
getMetadataImplementor().addEntity( entityBinding );
processedEntityNames.add( entityBinding.getEntity().getName() );
}
@ -363,7 +341,7 @@ public class HibernateMappingProcessor implements HbmBindingContext {
return;
}
for ( XMLHibernateMapping.XMLImport importValue : hibernateMapping.getImport() ) {
String className = getClassName( importValue.getClazz() );
String className = qualifyClassName( importValue.getClazz() );
String rename = importValue.getRename();
rename = ( rename == null ) ? StringHelper.unqualify( className ) : rename;
getMetadataImplementor().addImport( className, rename );
@ -407,7 +385,7 @@ public class HibernateMappingProcessor implements HbmBindingContext {
);
@Override
public String getClassName(String unqualifiedName) {
public String qualifyClassName(String unqualifiedName) {
return HbmHelper.getClassName( unqualifiedName, mappingDefaults.getPackageName() );
}

View File

@ -349,6 +349,18 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
return new JavaType( className, classLoaderService() );
}
@Override
public Value<Class<?>> makeClassReference(final String className) {
return new Value<Class<?>>(
new Value.DeferredInitializer<Class<?>>() {
@Override
public Class<?> initialize() {
return classLoaderService.getValue().classForName( className );
}
}
);
}
@Override
public Database getDatabase() {
return database;

View File

@ -33,10 +33,10 @@ import org.hibernate.EntityMode;
import org.hibernate.MappingException;
import org.hibernate.engine.OptimisticLockStyle;
import org.hibernate.engine.spi.FilterDefinition;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.domain.Attribute;
import org.hibernate.metamodel.domain.Entity;
import org.hibernate.metamodel.domain.JavaType;
import org.hibernate.metamodel.relational.Column;
import org.hibernate.metamodel.relational.TableSpecification;
import org.hibernate.persister.entity.EntityPersister;
@ -54,7 +54,7 @@ public class EntityBinding {
private TableSpecification baseTable;
private EntityMode entityMode;
private JavaType proxyInterfaceType;
private Value<Class<?>> proxyInterfaceType;
private String jpaEntityName;
@ -342,11 +342,11 @@ public class EntityBinding {
this.lazy = lazy;
}
public JavaType getProxyInterfaceType() {
public Value<Class<?>> getProxyInterfaceType() {
return proxyInterfaceType;
}
public void setProxyInterfaceType(JavaType proxyInterfaceType) {
public void setProxyInterfaceType(Value<Class<?>> proxyInterfaceType) {
this.proxyInterfaceType = proxyInterfaceType;
}

View File

@ -28,6 +28,8 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Set;
import org.hibernate.internal.util.Value;
/**
* Convenient base class for {@link AttributeContainer}. Because in our model all
* {@link AttributeContainer AttributeContainers} are also {@link Hierarchical} we also implement that here
@ -37,12 +39,16 @@ import java.util.Set;
*/
public abstract class AbstractAttributeContainer implements AttributeContainer, Hierarchical {
private final String name;
private final String className;
private final Value<Class<?>> classReference;
private final Hierarchical superType;
private LinkedHashSet<Attribute> attributeSet = new LinkedHashSet<Attribute>();
private HashMap<String, Attribute> attributeMap = new HashMap<String, Attribute>();
public AbstractAttributeContainer(String name, Hierarchical superType) {
public AbstractAttributeContainer(String name, String className, Value<Class<?>> classReference, Hierarchical superType) {
this.name = name;
this.className = className;
this.classReference = classReference;
this.superType = superType;
}
@ -51,6 +57,21 @@ public abstract class AbstractAttributeContainer implements AttributeContainer,
return name;
}
@Override
public String getClassName() {
return className;
}
@Override
public Class<?> getClassReference() {
return classReference.getValue();
}
@Override
public Value<Class<?>> getClassReferenceUnresolved() {
return classReference;
}
@Override
public Hierarchical getSuperType() {
return superType;

View File

@ -23,29 +23,49 @@
*/
package org.hibernate.metamodel.domain;
import org.hibernate.internal.util.Value;
/**
* Models a basic type.
*
* @author Steve Ebersole
*/
public class BasicType implements Type {
private final JavaType javaType;
private final String name;
private final Value<Class<?>> classReference;
public BasicType(JavaType javaType) {
this.javaType = javaType;
public BasicType(String name, Value<Class<?>> classReference) {
this.name = name;
this.classReference = classReference;
}
@Override
public String getName() {
return javaType.getName();
}
public JavaType getJavaType() {
return javaType;
return name;
}
@Override
public TypeNature getNature() {
return TypeNature.BASIC;
public String getClassName() {
return name;
}
@Override
public Class<?> getClassReference() {
return classReference.getValue();
}
@Override
public Value<Class<?>> getClassReferenceUnresolved() {
return classReference;
}
@Override
public boolean isAssociation() {
return false;
}
@Override
public boolean isComponent() {
return false;
}
}

View File

@ -23,6 +23,8 @@
*/
package org.hibernate.metamodel.domain;
import org.hibernate.internal.util.Value;
/**
* Models the notion of a component (what JPA calls an Embeddable).
* <p/>
@ -31,12 +33,17 @@ package org.hibernate.metamodel.domain;
* @author Steve Ebersole
*/
public class Component extends AbstractAttributeContainer implements Hierarchical {
public Component(String name, Hierarchical superType) {
super( name, superType );
public Component(String name, String className, Value<Class<?>> classReference, Hierarchical superType) {
super( name, className, classReference, superType );
}
@Override
public TypeNature getNature() {
return TypeNature.COMPONENT;
public boolean isAssociation() {
return false;
}
@Override
public boolean isComponent() {
return true;
}
}

View File

@ -23,6 +23,8 @@
*/
package org.hibernate.metamodel.domain;
import org.hibernate.internal.util.Value;
/**
* Models the notion of an entity
*
@ -30,27 +32,25 @@ package org.hibernate.metamodel.domain;
* @author Hardy Ferentschik
*/
public class Entity extends AbstractAttributeContainer {
final JavaType javaType;
/**
* Constructor for the entity
*
* @param name the name of the entity
* @param superType the super type for this entity. If there is not super type {@code null} needs to be passed.
* @param javaType the java type of the entity
* @param entityName The name of the entity
* @param className The name of this entity's java class
* @param classReference The reference to this entity's {@link Class}
* @param superType The super type for this entity. If there is not super type {@code null} needs to be passed.
*/
public Entity(String name, Hierarchical superType, JavaType javaType) {
super( name, superType );
this.javaType = javaType;
public Entity(String entityName, String className, Value<Class<?>> classReference, Hierarchical superType) {
super( entityName, className, classReference, superType );
}
@Override
public TypeNature getNature() {
return TypeNature.ENTITY;
public boolean isAssociation() {
return true;
}
public JavaType getJavaType() {
return javaType;
@Override
public boolean isComponent() {
return false;
}
}

View File

@ -23,20 +23,33 @@
*/
package org.hibernate.metamodel.domain;
import org.hibernate.internal.util.Value;
/**
* Models the concept class in the hierarchy with no persistent attributes.
*
* @author Hardy Ferentschik
*/
public class NonEntity extends AbstractAttributeContainer implements Hierarchical {
public NonEntity(String name, Hierarchical superType) {
super( name, superType );
/**
* Constructor for the non-entity
*
* @param entityName The name of the non-entity
* @param className The name of this non-entity's java class
* @param classReference The reference to this non-entity's {@link Class}
* @param superType The super type for this non-entity. If there is not super type {@code null} needs to be passed.
*/
public NonEntity(String entityName, String className, Value<Class<?>> classReference, Hierarchical superType) {
super( entityName, className, classReference, superType );
}
/**
* {@inheritDoc}
*/
public TypeNature getNature() {
return TypeNature.NON_ENTITY;
@Override
public boolean isAssociation() {
return true;
}
@Override
public boolean isComponent() {
return false;
}
}

View File

@ -23,20 +23,33 @@
*/
package org.hibernate.metamodel.domain;
import org.hibernate.internal.util.Value;
/**
* Models the concept of a (intermediate) superclass
*
* @author Steve Ebersole
*/
public class Superclass extends AbstractAttributeContainer implements Hierarchical {
public Superclass(String name, Hierarchical superType) {
super( name, superType );
/**
* Constructor for the entity
*
* @param entityName The name of the entity
* @param className The name of this entity's java class
* @param classReference The reference to this entity's {@link Class}
* @param superType The super type for this entity. If there is not super type {@code null} needs to be passed.
*/
public Superclass(String entityName, String className, Value<Class<?>> classReference, Hierarchical superType) {
super( entityName, className, classReference, superType );
}
/**
* {@inheritDoc}
*/
public TypeNature getNature() {
return TypeNature.SUPERCLASS;
@Override
public boolean isAssociation() {
return true;
}
@Override
public boolean isComponent() {
return false;
}
}

View File

@ -23,6 +23,8 @@
*/
package org.hibernate.metamodel.domain;
import org.hibernate.internal.util.Value;
/**
* Basic information about a Java type, in regards to its role in particular set of mappings.
*
@ -30,16 +32,32 @@ package org.hibernate.metamodel.domain;
*/
public interface Type {
/**
* Get the name of the type.
* Obtain the name of the type.
*
* @return The name
*/
public String getName();
/**
* Return the persistence type.
* Obtain the java class name for this type.
*
* @return persistence type
* @return The class name
*/
public TypeNature getNature();
public String getClassName();
/**
* Obtain the java {@link Class} reference for this type
*
* @return The {@link Class} reference
*
* @throws org.hibernate.service.classloading.spi.ClassLoadingException Indicates the class reference
* could not be determined. Generally this is the case in reverse-engineering scenarios where the specified
* domain model classes do not yet exist.
*/
public Class<?> getClassReference();
public Value<Class<?>> getClassReferenceUnresolved();
public boolean isAssociation();
public boolean isComponent();
}

View File

@ -377,10 +377,10 @@ public class EntityMetamodel implements Serializable {
Class<?> mappedClass = null;
Class<?> proxyInterfaceClass = null;
boolean lazyAvailable = false;
if ( entityBinding.getEntity().getJavaType() != null ) {
if ( entityBinding.getEntity().getClassReferenceUnresolved() != null ) {
hasPojoRepresentation = true;
mappedClass = entityBinding.getEntity().getJavaType().getClassReference();
proxyInterfaceClass = entityBinding.getProxyInterfaceType().getClassReference();
mappedClass = entityBinding.getEntity().getClassReference();
proxyInterfaceClass = entityBinding.getProxyInterfaceType().getValue();
lazyAvailable = FieldInterceptionHelper.isInstrumented( mappedClass );
}
@ -698,7 +698,7 @@ public class EntityMetamodel implements Serializable {
private void mapPropertyToIndex(Attribute attribute, int i) {
propertyIndexes.put( attribute.getName(), i );
if ( attribute.isSingular() &&
( ( SingularAttribute ) attribute ).getSingularAttributeType().getNature() == TypeNature.COMPONENT ) {
( ( SingularAttribute ) attribute ).getSingularAttributeType().isComponent() ) {
org.hibernate.metamodel.domain.Component component =
( org.hibernate.metamodel.domain.Component ) ( ( SingularAttribute ) attribute ).getSingularAttributeType();
for ( Attribute subAttribute : component.getAttributes() ) {

View File

@ -1,19 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:bindings schemaLocation="../resources/org/hibernate/hibernate-configuration-4.0.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:nameXmlTransform>
<jxb:typeName prefix="XML"/>
<jxb:elementName prefix="XML"/>
<jxb:modelGroupName prefix="XML"/>
<jxb:anonymousTypeName prefix="XML"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jxb:bindings>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.1">
</jxb:bindings>
<jaxb:bindings schemaLocation="../resources/org/hibernate/hibernate-configuration-4.0.xsd" node="/xsd:schema">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName prefix="XML"/>
<jaxb:elementName prefix="XML"/>
<jaxb:modelGroupName prefix="XML"/>
<jaxb:anonymousTypeName prefix="XML"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@ -1,103 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:bindings schemaLocation="../resources/org/hibernate/hibernate-mapping-4.0.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:nameXmlTransform>
<jxb:typeName prefix="XML"/>
<jxb:elementName prefix="XML"/>
<jxb:modelGroupName prefix="XML"/>
<jxb:anonymousTypeName prefix="XML"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
<jxb:bindings node="//xs:element[@name='class']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:element[@name='discriminator']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:element[@name='discriminator']//xs:attribute[@name='formula']">
<jxb:property name="formulaAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:element[@name='id']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:element[@name='id']//xs:attribute[@name='type']">
<jxb:property name="typeAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:element[@name='version']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='array-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='bag-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='element-element']//xs:attribute[@name='type']">
<jxb:property name="typeAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='idbag-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='idbag-element']//xs:element[@name='collection-id']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='index-element']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='join-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='joined-subclass-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='key-element']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='key-many-to-one-element']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='key-property-element']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='key-property-element']//xs:attribute[@name='type']">
<jxb:property name="typeAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='list-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='list-index-element']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='map-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='map-element']//xs:element[@name='map-key']//xs:attribute[@name='type']">
<jxb:property name="typeAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='map-element']//xs:element[@name='index-many-to-many']//xs:attribute[@name='column']">
<jxb:property name="columnAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='one-to-one-element']//xs:attribute[@name='formula']">
<jxb:property name="formulaAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='primitive-array-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='property-element']//xs:attribute[@name='type']">
<jxb:property name="typeAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='set-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
<jxb:bindings node="//xs:complexType[@name='union-subclass-element']//xs:attribute[@name='subselect']">
<jxb:property name="subselectAttribute"/>
</jxb:bindings>
</jxb:bindings>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance"
jaxb:extensionBindingPrefixes="inheritance"
jaxb:version="2.1">
</jxb:bindings>
<jaxb:bindings schemaLocation="../resources/org/hibernate/hibernate-mapping-4.0.xsd" node="/xsd:schema">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName prefix="XML"/>
<jaxb:elementName prefix="XML"/>
<jaxb:modelGroupName prefix="XML"/>
<jaxb:anonymousTypeName prefix="XML"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
<!-- Inheritance -->
<jaxb:bindings node="//xsd:element[@name='class']/xsd:complexType">
<inheritance:implements>org.hibernate.metamodel.binder.source.hbm.xml.mapping.EntityElement</inheritance:implements>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='subclass-element']">
<inheritance:implements>org.hibernate.metamodel.binder.source.hbm.xml.mapping.SubclassEntityElement</inheritance:implements>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='joined-subclass-element']">
<inheritance:implements>org.hibernate.metamodel.binder.source.hbm.xml.mapping.SubclassEntityElement</inheritance:implements>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='union-subclass-element']">
<inheritance:implements>org.hibernate.metamodel.binder.source.hbm.xml.mapping.SubclassEntityElement</inheritance:implements>
</jaxb:bindings>
<jaxb:bindings node="//xsd:element[@name='class']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:element[@name='discriminator']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:element[@name='discriminator']//xsd:attribute[@name='formula']">
<jaxb:property name="formulaAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:element[@name='id']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:element[@name='id']//xsd:attribute[@name='type']">
<jaxb:property name="typeAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:element[@name='version']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='array-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='bag-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='element-element']//xsd:attribute[@name='type']">
<jaxb:property name="typeAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='idbag-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='idbag-element']//xsd:element[@name='collection-id']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='index-element']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='join-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='joined-subclass-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='key-element']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='key-many-to-one-element']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='key-property-element']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='key-property-element']//xsd:attribute[@name='type']">
<jaxb:property name="typeAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='list-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='list-index-element']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='map-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='map-element']//xsd:element[@name='map-key']//xsd:attribute[@name='type']">
<jaxb:property name="typeAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='map-element']//xsd:element[@name='index-many-to-many']//xsd:attribute[@name='column']">
<jaxb:property name="columnAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='one-to-one-element']//xsd:attribute[@name='formula']">
<jaxb:property name="formulaAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='primitive-array-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='property-element']//xsd:attribute[@name='type']">
<jaxb:property name="typeAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='set-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
<jaxb:bindings node="//xsd:complexType[@name='union-subclass-element']//xsd:attribute[@name='subselect']">
<jaxb:property name="subselectAttribute"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>

View File

@ -1,19 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
<jxb:bindings schemaLocation="../resources/org/hibernate/ejb/orm_2_0.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:nameXmlTransform>
<jxb:typeName prefix="XML"/>
<jxb:elementName prefix="XML"/>
<jxb:modelGroupName prefix="XML"/>
<jxb:anonymousTypeName prefix="XML"/>
</jxb:nameXmlTransform>
</jxb:schemaBindings>
</jxb:bindings>
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
jaxb:version="2.1">
</jxb:bindings>
<jaxb:bindings schemaLocation="../resources/org/hibernate/ejb/orm_2_0.xsd" node="/xsd:schema">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName prefix="XML"/>
<jaxb:elementName prefix="XML"/>
<jaxb:modelGroupName prefix="XML"/>
<jaxb:anonymousTypeName prefix="XML"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>