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

This commit is contained in:
Steve Ebersole 2011-07-11 17:26:17 -05:00
parent c4c8c28a3b
commit e339dac91e
177 changed files with 586 additions and 2001 deletions

View File

@ -76,7 +76,7 @@ task jaxb {
// hibernate-configuration
ant.xjc(
destdir: '${jaxbTargetDir}',
package: 'org.hibernate.metamodel.source.hbm.xml.config',
package: 'org.hibernate.metamodel.source.hbm.jaxb.config',
binding: 'src/main/xjb/hbm-configuration-bindings.xjb',
schema: cfgXsd.path
)
@ -84,7 +84,7 @@ task jaxb {
// hibernate-mapping
ant.xjc(
destdir: '${jaxbTargetDir}',
package: 'org.hibernate.metamodel.source.hbm.xml.mapping',
package: 'org.hibernate.metamodel.source.hbm.jaxb.mapping',
binding: hbmXjb.path,
schema: hbmXsd.path,
extension: 'true'
@ -95,7 +95,7 @@ task jaxb {
// orm.xml (jpa)
ant.xjc(
destdir: '${jaxbTargetDir}',
package: 'org.hibernate.metamodel.source.annotation.xml',
package: 'org.hibernate.metamodel.source.annotation.jaxb',
binding: 'src/main/xjb/orm-bindings.xjb',
schema: ormXsd.path
)

View File

@ -24,7 +24,7 @@
package org.hibernate;
import org.hibernate.internal.util.xml.XmlDocument;
import org.hibernate.metamodel.binder.Origin;
import org.hibernate.metamodel.source.Origin;
/**
* Thrown when a mapping is found to be invalid.

View File

@ -26,7 +26,7 @@ package org.hibernate.event.service.internal;
import org.hibernate.cfg.Configuration;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.event.service.spi.EventListenerRegistry;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.service.spi.SessionFactoryServiceInitiator;

View File

@ -112,7 +112,7 @@ import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.binding.PluralAttributeBinding;
import org.hibernate.persister.collection.CollectionPersister;

View File

@ -43,13 +43,13 @@ import org.xml.sax.EntityResolver;
import org.hibernate.cfg.EJB3DTDEntityResolver;
import org.hibernate.cfg.EJB3NamingStrategy;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.metamodel.binder.MappingException;
import org.hibernate.metamodel.binder.MappingNotFoundException;
import org.hibernate.metamodel.binder.Origin;
import org.hibernate.metamodel.binder.SourceType;
import org.hibernate.metamodel.binder.source.internal.JaxbHelper;
import org.hibernate.metamodel.binder.source.internal.JaxbRoot;
import org.hibernate.metamodel.binder.source.internal.MetadataBuilderImpl;
import org.hibernate.metamodel.source.MappingException;
import org.hibernate.metamodel.source.MappingNotFoundException;
import org.hibernate.metamodel.source.Origin;
import org.hibernate.metamodel.source.SourceType;
import org.hibernate.metamodel.source.internal.JaxbHelper;
import org.hibernate.metamodel.source.internal.JaxbRoot;
import org.hibernate.metamodel.source.internal.MetadataBuilderImpl;
import org.hibernate.service.BasicServiceRegistry;
import org.hibernate.service.classloading.spi.ClassLoaderService;

View File

@ -1,30 +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.source;
/**
* @author Steve Ebersole
*/
public interface DiscriminatorSubClassEntityDescriptor extends EntityDescriptor {
}

View File

@ -1,132 +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.source;
import java.util.Set;
import org.hibernate.EntityMode;
import org.hibernate.metamodel.binding.Caching;
import org.hibernate.metamodel.binding.CustomSQL;
import org.hibernate.metamodel.binding.InheritanceType;
import org.hibernate.metamodel.domain.Hierarchical;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.tuple.entity.EntityTuplizer;
/**
* Represents the normalized set of mapping information about a specific entity.
*
* @author Gail Badner
* @author Steve Ebersole
*/
public interface EntityDescriptor extends UnifiedDescriptorObject {
/**
* Obtain the Hibernate entity name.
*
* @return The entity name.
*/
public String getEntityName();
/**
* Obtain the JPA entity name.
*
* @return The JPA entity name
*/
public String getJpaEntityName();
/**
* Obtain the entity mode represented by this state.
*
* @return The entity mode.
*/
public EntityMode getEntityMode();
/**
* Obtain the name of the entity class.
*
* @return The entity class name.
*/
public String getClassName();
/**
* The name of an interface to use for creating instance proxies for this entity.
*
* @return The name of the proxy interface.
*/
public String getProxyInterfaceName();
/**
* Obtains the type of inheritance defined for this entity hierarchy
*
* @return The inheritance strategy for this entity.
*/
public InheritanceType getEntityInheritanceType();
/**
* Obtain the super type for this entity.
*
* @return This entity's super type.
*/
public String getSuperEntityName();
/**
* Obtain the custom {@link EntityPersister} class defined in this mapping. {@code null} indicates the default
* should be used.
*
* @return The custom {@link EntityPersister} class to use; or {@code null}
*/
public Class<? extends EntityPersister> getCustomEntityPersisterClass();
/**
* Obtain the custom {@link EntityTuplizer} class defined in this mapping. {@code null} indicates the default
* should be used.
*
* @return The custom {@link EntityTuplizer} class to use; or {@code null}
*/
public Class<? extends EntityTuplizer> getCustomEntityTuplizerClass();
boolean isLazy();
boolean isDynamicUpdate();
boolean isDynamicInsert();
int getBatchSize();
boolean isSelectBeforeUpdate();
Boolean isAbstract();
String getCustomLoaderName();
CustomSQL getCustomInsert();
CustomSQL getCustomUpdate();
CustomSQL getCustomDelete();
Set<String> getSynchronizedTableNames();
}

View File

@ -1,30 +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.source;
/**
* @author Steve Ebersole
*/
public interface JoinedSubClassEntityDescriptor extends EntityDescriptor {
}

View File

@ -1,33 +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.source;
/**
* @author Steve Ebersole
*/
public interface TableDescriptor extends UnifiedDescriptorObject {
public String getExplicitSchemaName();
public String getExplicitCatalogName();
public String getTableName();
}

View File

@ -1,35 +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.source;
import org.hibernate.metamodel.binder.Origin;
/**
* @author Steve Ebersole
*/
public interface UnifiedDescriptorObject {
public Origin getOrigin();
public UnifiedDescriptorObject getContainingDescriptor();
public MetaAttributeContext getMetaAttributeContext();
}

View File

@ -1,30 +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.source;
/**
* @author Steve Ebersole
*/
public interface UnionSubClassEntityDescriptor extends EntityDescriptor {
}

View File

@ -1,358 +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.source.annotations;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationValue;
import org.hibernate.EntityMode;
import org.hibernate.annotations.ResultCheckStyle;
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
import org.hibernate.metamodel.binder.Origin;
import org.hibernate.metamodel.binder.source.EntityDescriptor;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.binder.source.UnifiedDescriptorObject;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClass;
import org.hibernate.metamodel.binding.CustomSQL;
import org.hibernate.metamodel.binding.InheritanceType;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.tuple.entity.EntityTuplizer;
/**
* @author Steve Ebersole
*/
public abstract class AbstractEntityDescriptorImpl implements EntityDescriptor {
private final ConfiguredClass configuredClass;
@SuppressWarnings( {"FieldCanBeLocal", "UnusedDeclaration"}) // for now this is not used.
private final AnnotationsBindingContext bindingContext;
private final String jpaEntityName;
private final String superEntityName;
private final InheritanceType inheritanceType;
private final boolean lazy;
private final String proxyInterfaceName;
private final Class<EntityPersister> entityPersisterClass;
private final Class<EntityTuplizer> tuplizerClass;
private final int batchSize;
private final boolean dynamicUpdate;
private final boolean dynamicInsert;
private final boolean selectBeforeUpdate;
private final String customLoaderName;
private final CustomSQL customInsert;
private final CustomSQL customUpdate;
private final CustomSQL customDelete;
private final Set<String> synchronizedTableNames;
public AbstractEntityDescriptorImpl(
ConfiguredClass configuredClass,
String superEntityName,
InheritanceType inheritanceType,
AnnotationsBindingContext bindingContext) {
this.configuredClass = configuredClass;
this.superEntityName = superEntityName;
this.inheritanceType = inheritanceType;
this.bindingContext = bindingContext;
final AnnotationInstance jpaEntityAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), JPADotNames.ENTITY
);
final AnnotationValue explicitJpaEntityName = jpaEntityAnnotation.value( "name" );
if ( explicitJpaEntityName == null ) {
jpaEntityName = configuredClass.getName();
}
else {
jpaEntityName = explicitJpaEntityName.asString();
}
final AnnotationInstance hibernateEntityAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.ENTITY
);
this.dynamicInsert = hibernateEntityAnnotation != null
&& hibernateEntityAnnotation.value( "dynamicInsert" ) != null
&& hibernateEntityAnnotation.value( "dynamicInsert" ).asBoolean();
this.dynamicUpdate = hibernateEntityAnnotation != null
&& hibernateEntityAnnotation.value( "dynamicUpdate" ) != null
&& hibernateEntityAnnotation.value( "dynamicUpdate" ).asBoolean();
this.selectBeforeUpdate = hibernateEntityAnnotation != null
&& hibernateEntityAnnotation.value( "selectBeforeUpdate" ) != null
&& hibernateEntityAnnotation.value( "selectBeforeUpdate" ).asBoolean();
final AnnotationInstance sqlLoaderAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.LOADER
);
this.customLoaderName = sqlLoaderAnnotation == null
? null
: sqlLoaderAnnotation.value( "namedQuery" ).asString();
final AnnotationInstance sqlInsertAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.SQL_INSERT
);
this.customInsert = createCustomSQL( sqlInsertAnnotation );
final AnnotationInstance sqlUpdateAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.SQL_UPDATE
);
this.customUpdate = createCustomSQL( sqlUpdateAnnotation );
final AnnotationInstance sqlDeleteAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.SQL_DELETE
);
this.customDelete = createCustomSQL( sqlDeleteAnnotation );
final AnnotationInstance batchSizeAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.BATCH_SIZE
);
this.batchSize = batchSizeAnnotation == null
? -1
: batchSizeAnnotation.value( "size" ).asInt();
final AnnotationInstance hibernateProxyAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.PROXY
);
if ( hibernateProxyAnnotation != null ) {
this.lazy = hibernateProxyAnnotation.value( "lazy" ) == null
|| hibernateProxyAnnotation.value( "lazy" ).asBoolean();
final AnnotationValue proxyClassValue = hibernateProxyAnnotation.value( "proxyClass" );
if ( proxyClassValue == null ) {
this.proxyInterfaceName = null;
}
else {
this.proxyInterfaceName = bindingContext.locateClassByName( proxyClassValue.asString() ).getName();
}
}
else {
this.lazy = true;
this.proxyInterfaceName = configuredClass.getName();
}
final AnnotationInstance persisterAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.PERSISTER
);
if ( persisterAnnotation == null || persisterAnnotation.value( "impl" ) == null ) {
if ( hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "persister" ) != null ) {
this.entityPersisterClass = bindingContext.locateClassByName( hibernateEntityAnnotation.value( "persister" ).asString() );
}
else {
this.entityPersisterClass = null;
}
}
else {
if ( hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "persister" ) != null ) {
// todo : error?
}
this.entityPersisterClass = bindingContext.locateClassByName( persisterAnnotation.value( "impl" ).asString() );
}
final AnnotationInstance pojoTuplizerAnnotation = locatePojoTuplizerAnnotation();
if ( pojoTuplizerAnnotation == null ) {
tuplizerClass = null;
}
else {
tuplizerClass = bindingContext.locateClassByName( pojoTuplizerAnnotation.value( "impl" ).asString() );
}
final AnnotationInstance synchronizeAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.SYNCHRONIZE
);
if ( synchronizeAnnotation != null ) {
synchronizedTableNames = new HashSet<String>();
final String[] tableNames = synchronizeAnnotation.value().asStringArray();
synchronizedTableNames.addAll( Arrays.asList( tableNames ) );
}
else {
synchronizedTableNames = java.util.Collections.emptySet();
}
}
private CustomSQL createCustomSQL(AnnotationInstance customSQLAnnotation) {
if ( customSQLAnnotation == null ) {
return null;
}
String sql = customSQLAnnotation.value( "sql" ).asString();
boolean isCallable = false;
AnnotationValue callableValue = customSQLAnnotation.value( "callable" );
if ( callableValue != null ) {
isCallable = callableValue.asBoolean();
}
ResultCheckStyle checkStyle = ResultCheckStyle.NONE;
AnnotationValue checkStyleValue = customSQLAnnotation.value( "check" );
if ( checkStyleValue != null ) {
checkStyle = Enum.valueOf( ResultCheckStyle.class, checkStyleValue.asEnum() );
}
return new CustomSQL(
sql,
isCallable,
Enum.valueOf( ExecuteUpdateResultCheckStyle.class, checkStyle.toString() )
);
}
private AnnotationInstance locatePojoTuplizerAnnotation() {
final AnnotationInstance tuplizersAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.SYNCHRONIZE
);
if ( tuplizersAnnotation == null ) {
return null;
}
for ( AnnotationInstance tuplizerAnnotation : JandexHelper.getValueAsArray(tuplizersAnnotation, "value" ) ) {
if ( EntityMode.valueOf( tuplizerAnnotation.value( "entityModeType" ).asEnum() ) == EntityMode.POJO ) {
return tuplizerAnnotation;
}
}
return null;
}
@Override
public String getClassName() {
return configuredClass.getName();
}
@Override
public String getEntityName() {
return getClassName();
}
@Override
public String getJpaEntityName() {
return jpaEntityName;
}
@Override
public EntityMode getEntityMode() {
return EntityMode.POJO;
}
@Override
public String getProxyInterfaceName() {
return proxyInterfaceName;
}
@Override
public Class<EntityPersister> getCustomEntityPersisterClass() {
return entityPersisterClass;
}
@Override
public Class<EntityTuplizer> getCustomEntityTuplizerClass() {
return tuplizerClass;
}
@Override
public String getSuperEntityName() {
return superEntityName;
}
@Override
public InheritanceType getEntityInheritanceType() {
return inheritanceType;
}
@Override
public MetaAttributeContext getMetaAttributeContext() {
return null;
}
@Override
public boolean isLazy() {
return lazy;
}
@Override
public boolean isDynamicUpdate() {
return dynamicUpdate;
}
@Override
public boolean isDynamicInsert() {
return dynamicInsert;
}
@Override
public int getBatchSize() {
return batchSize;
}
@Override
public boolean isSelectBeforeUpdate() {
return selectBeforeUpdate;
}
@Override
public Boolean isAbstract() {
return false;
}
@Override
public String getCustomLoaderName() {
return customLoaderName;
}
@Override
public CustomSQL getCustomInsert() {
return customInsert;
}
@Override
public CustomSQL getCustomUpdate() {
return customUpdate;
}
@Override
public CustomSQL getCustomDelete() {
return customDelete;
}
@Override
public Set<String> getSynchronizedTableNames() {
return synchronizedTableNames;
}
@Override
public UnifiedDescriptorObject getContainingDescriptor() {
return null;
}
@Override
public Origin getOrigin() {
// return bindingContext.getOrigin();
return null;
}
}

View File

@ -1,131 +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.source.annotations;
import java.util.List;
import org.jboss.jandex.AnnotationInstance;
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.source.MappingDefaults;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClass;
import org.hibernate.metamodel.binder.source.annotations.entity.EntityBinder;
import org.hibernate.metamodel.binder.source.internal.OverriddenMappingDefaults;
import org.hibernate.metamodel.domain.Type;
import org.hibernate.service.ServiceRegistry;
/**
* @author Hardy Ferentschik
* @author Steve Ebersole
*/
public class AnnotationsMetadataProcessor implements AnnotationsBindingContext {
private final AnnotationsBindingContext parentBindingContext;
private final ConfiguredClass configuredClass;
private final MappingDefaults mappingDefaults;
private final EntityBinder entityBinder;
public AnnotationsMetadataProcessor(
AnnotationsBindingContext parentBindingContext,
ConfiguredClass configuredClass) {
this.parentBindingContext = parentBindingContext;
this.configuredClass = configuredClass;
String explicitSchemaName = null;
String explicitCatalogName = null;
AnnotationInstance tableAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(),
JPADotNames.TABLE
);
if ( tableAnnotation != null ) {
AnnotationValue schemaValue = tableAnnotation.value( "schema" );
explicitSchemaName = schemaValue != null ? schemaValue.asString() : null;
AnnotationValue catalogValue = tableAnnotation.value( "catalog" );
explicitCatalogName = catalogValue != null ? catalogValue.asString() : null;
}
this.mappingDefaults = new OverriddenMappingDefaults(
parentBindingContext.getMappingDefaults(),
null, // packageName
explicitSchemaName,
explicitCatalogName,
null, // idColumnName
null, // discriminatorColumnName
null, // cascade
null, // property accessor
null // association laziness
);
this.entityBinder = new EntityBinder( configuredClass, this );
}
public void processMappingMetadata(List<String> processedEntityNames) {
entityBinder.bind( processedEntityNames );
}
@Override
public Index getIndex() {
return parentBindingContext.getIndex();
}
@Override
public ServiceRegistry getServiceRegistry() {
return parentBindingContext.getServiceRegistry();
}
@Override
public NamingStrategy getNamingStrategy() {
return parentBindingContext.getNamingStrategy();
}
@Override
public MappingDefaults getMappingDefaults() {
return mappingDefaults;
}
@Override
public MetadataImplementor getMetadataImplementor() {
return parentBindingContext.getMetadataImplementor();
}
@Override
public <T> Class<T> locateClassByName(String name) {
return parentBindingContext.locateClassByName( name );
}
@Override
public Type makeJavaType(String className) {
return parentBindingContext.makeJavaType( className );
}
@Override
public Value<Class<?>> makeClassReference(String className) {
return parentBindingContext.makeClassReference( className );
}
}

View File

@ -1,209 +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.source.annotations;
import javax.persistence.SharedCacheMode;
import org.jboss.jandex.AnnotationInstance;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.OptimisticLockType;
import org.hibernate.annotations.PolymorphismType;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.engine.OptimisticLockStyle;
import org.hibernate.metamodel.binder.source.RootEntityDescriptor;
import org.hibernate.metamodel.binder.source.TableDescriptor;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClass;
import org.hibernate.metamodel.binding.Caching;
import org.hibernate.metamodel.binding.InheritanceType;
/**
* @author Steve Ebersole
* @author Gail Badner
* @author Hardy Ferentschik
*/
public class RootEntityDescriptorImpl extends AbstractEntityDescriptorImpl implements RootEntityDescriptor {
private final boolean mutable;
private final boolean explicitPolymorphism;
private final String whereFilter;
private final String rowId;
private final Caching caching;
private final OptimisticLockStyle optimisticLockStyle;
private final TableDescriptor baseTableDescriptor;
public RootEntityDescriptorImpl(ConfiguredClass configuredClass, AnnotationsBindingContext bindingContext) {
super( configuredClass, null, InheritanceType.NO_INHERITANCE, bindingContext );
final AnnotationInstance hibernateEntityAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.ENTITY
);
OptimisticLockType optimisticLockType = OptimisticLockType.VERSION;
if ( hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "optimisticLock" ) != null ) {
optimisticLockType = OptimisticLockType.valueOf( hibernateEntityAnnotation.value( "optimisticLock" ).asEnum() );
}
this.optimisticLockStyle = OptimisticLockStyle.valueOf( optimisticLockType.name() );
final PolymorphismType polymorphism = hibernateEntityAnnotation != null && hibernateEntityAnnotation.value( "polymorphism" ) != null
? PolymorphismType.valueOf( hibernateEntityAnnotation.value( "polymorphism" ).asEnum() )
: PolymorphismType.IMPLICIT;
this.explicitPolymorphism = polymorphism != PolymorphismType.IMPLICIT;
final AnnotationInstance hibernateImmutableAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.IMMUTABLE
);
this.mutable = hibernateImmutableAnnotation == null
&& hibernateEntityAnnotation != null
&& hibernateEntityAnnotation.value( "mutable" ) != null
&& hibernateEntityAnnotation.value( "mutable" ).asBoolean();
final AnnotationInstance whereAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.WHERE
);
this.whereFilter = whereAnnotation != null && whereAnnotation.value( "clause" ) != null
? whereAnnotation.value( "clause" ).asString()
: null;
final AnnotationInstance rowIdAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.ROW_ID
);
this.rowId = rowIdAnnotation != null && rowIdAnnotation.value() != null
? rowIdAnnotation.value().asString()
: null;
this.caching = interpretCaching( configuredClass, bindingContext );
final AnnotationInstance tableAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), JPADotNames.TABLE
);
this.baseTableDescriptor = new TableDescriptorImpl(
tableAnnotation.value( "schema" ) == null
? null
: tableAnnotation.value( "schema" ).asString(),
tableAnnotation.value( "catalog" ) == null
? null
: tableAnnotation.value( "catalog" ).asString(),
tableAnnotation.value( "name" ) == null
? null
: tableAnnotation.value( "name" ).asString(),
this,
bindingContext
);
}
private Caching interpretCaching(ConfiguredClass configuredClass, AnnotationsBindingContext bindingContext) {
final AnnotationInstance hibernateCacheAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), HibernateDotNames.CACHE
);
if ( hibernateCacheAnnotation != null ) {
final AccessType accessType = hibernateCacheAnnotation.value( "usage" ) == null
? bindingContext.getMappingDefaults().getCacheAccessType()
: CacheConcurrencyStrategy.parse( hibernateCacheAnnotation.value( "usage" ).asEnum() ).toAccessType();
return new Caching(
hibernateCacheAnnotation.value( "region" ) == null
? configuredClass.getName()
: hibernateCacheAnnotation.value( "region" ).asString(),
accessType,
hibernateCacheAnnotation.value( "include" ) != null
&& "all".equals( hibernateCacheAnnotation.value( "include" ).asString() )
);
}
final AnnotationInstance jpaCacheableAnnotation = JandexHelper.getSingleAnnotation(
configuredClass.getClassInfo(), JPADotNames.CACHEABLE
);
boolean cacheable = true; // true is the default
if ( jpaCacheableAnnotation != null && jpaCacheableAnnotation.value() != null ) {
cacheable = jpaCacheableAnnotation.value().asBoolean();
}
final boolean doCaching;
switch ( bindingContext.getMetadataImplementor().getOptions().getSharedCacheMode() ) {
case ALL: {
doCaching = true;
break;
}
case ENABLE_SELECTIVE: {
doCaching = cacheable;
break;
}
case DISABLE_SELECTIVE: {
doCaching = jpaCacheableAnnotation == null || cacheable;
break;
}
default: {
// treat both NONE and UNSPECIFIED the same
doCaching = false;
break;
}
}
if ( ! doCaching ) {
return null;
}
return new Caching(
configuredClass.getName(),
bindingContext.getMappingDefaults().getCacheAccessType(),
true
);
}
@Override
public boolean isMutable() {
return mutable;
}
@Override
public boolean isExplicitPolymorphism() {
return explicitPolymorphism;
}
@Override
public String getWhereFilter() {
return whereFilter;
}
@Override
public String getRowId() {
return rowId;
}
@Override
public Caching getCaching() {
return caching;
}
@Override
public OptimisticLockStyle getOptimisticLockStyle() {
return optimisticLockStyle;
}
@Override
public TableDescriptor getBaseTable() {
return baseTableDescriptor;
}
}

View File

@ -1,85 +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.source.annotations;
import org.hibernate.metamodel.binder.Origin;
import org.hibernate.metamodel.binder.source.EntityDescriptor;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.binder.source.TableDescriptor;
import org.hibernate.metamodel.binder.source.UnifiedDescriptorObject;
/**
* @author Steve Ebersole
*/
public class TableDescriptorImpl implements TableDescriptor {
private final String explicitSchemaName;
private final String explicitCatalogName;
private final String tableName;
private final EntityDescriptor entityDescriptor;
private final AnnotationsBindingContext bindingContext;
public TableDescriptorImpl(
String explicitSchemaName,
String explicitCatalogName,
String tableName,
EntityDescriptor entityDescriptor, AnnotationsBindingContext bindingContext) {
this.explicitSchemaName = explicitSchemaName;
this.explicitCatalogName = explicitCatalogName;
this.tableName = tableName;
this.entityDescriptor = entityDescriptor;
this.bindingContext = bindingContext;
}
@Override
public String getExplicitSchemaName() {
return explicitSchemaName;
}
@Override
public String getExplicitCatalogName() {
return explicitCatalogName;
}
@Override
public String getTableName() {
return tableName;
}
@Override
public Origin getOrigin() {
// return bindingContext.getOrigin();
return null;
}
@Override
public UnifiedDescriptorObject getContainingDescriptor() {
return entityDescriptor;
}
@Override
public MetaAttributeContext getMetaAttributeContext() {
return null;
}
}

View File

@ -1,259 +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.source.annotations.entity.state.binding;
import java.util.HashSet;
import java.util.Set;
import org.hibernate.EntityMode;
import org.hibernate.metamodel.binder.Origin;
import org.hibernate.metamodel.binder.source.BindingContext;
import org.hibernate.metamodel.binder.source.EntityDescriptor;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.binder.source.UnifiedDescriptorObject;
import org.hibernate.metamodel.binding.CustomSQL;
import org.hibernate.metamodel.binding.InheritanceType;
import org.hibernate.metamodel.source.annotations.entity.EntityClass;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.tuple.entity.EntityTuplizer;
/**
* @author Hardy Ferentschik
*/
public abstract class AbstractEntityDescriptorImpl implements EntityDescriptor {
private final BindingContext bindingContext;
private final String className;
private final String superEntityName;
private final InheritanceType inheritanceType;
private String jpaEntityName;
private boolean lazy;
private String proxyInterfaceName;
private Class<? extends EntityPersister> persisterClass;
private Class<? extends EntityTuplizer> tuplizerClass;
private boolean dynamicUpdate;
private boolean dynamicInsert;
private int batchSize = -1;
private boolean selectBeforeUpdate;
private String customLoaderName;
private CustomSQL customInsert;
private CustomSQL customUpdate;
private CustomSQL customDelete;
private Set<String> synchronizedTableNames = new HashSet<String>();
public AbstractEntityDescriptorImpl(
EntityClass entityClass,
String superEntityName,
BindingContext bindingContext) {
this.bindingContext = bindingContext;
this.className = entityClass.getName();
this.superEntityName = superEntityName;
this.inheritanceType = entityClass.getInheritanceType();
}
@Override
public String getEntityName() {
return className;
}
@Override
public String getClassName() {
return className;
}
@Override
public String getJpaEntityName() {
return jpaEntityName;
}
public void setJpaEntityName(String entityName) {
this.jpaEntityName = entityName;
}
@Override
public EntityMode getEntityMode() {
return EntityMode.POJO;
}
@Override
public String getSuperEntityName() {
return superEntityName;
}
@Override
public InheritanceType getEntityInheritanceType() {
return inheritanceType;
}
@Override
public Boolean isAbstract() {
// no annotations equivalent
return Boolean.FALSE;
}
@Override
public boolean isLazy() {
return lazy;
}
public void setLazy(boolean lazy) {
this.lazy = lazy;
}
@Override
public String getProxyInterfaceName() {
return proxyInterfaceName;
}
public void setProxyInterfaceName(String proxyInterfaceName) {
this.proxyInterfaceName = proxyInterfaceName;
}
@Override
public Class<? extends EntityPersister> getCustomEntityPersisterClass() {
return persisterClass;
}
public void setPersisterClass(Class<? extends EntityPersister> persisterClass) {
this.persisterClass = persisterClass;
}
@Override
public Class<? extends EntityTuplizer> getCustomEntityTuplizerClass() {
return tuplizerClass;
}
public void setTuplizerClass(Class<? extends EntityTuplizer> tuplizerClass) {
this.tuplizerClass = tuplizerClass;
}
@Override
public boolean isDynamicUpdate() {
return dynamicUpdate;
}
public void setDynamicUpdate(boolean dynamicUpdate) {
this.dynamicUpdate = dynamicUpdate;
}
@Override
public boolean isDynamicInsert() {
return dynamicInsert;
}
public void setDynamicInsert(boolean dynamicInsert) {
this.dynamicInsert = dynamicInsert;
}
@Override
public int getBatchSize() {
return batchSize;
}
public void setBatchSize(int batchSize) {
this.batchSize = batchSize;
}
@Override
public boolean isSelectBeforeUpdate() {
return selectBeforeUpdate;
}
public void setSelectBeforeUpdate(boolean selectBeforeUpdate) {
this.selectBeforeUpdate = selectBeforeUpdate;
}
@Override
public String getCustomLoaderName() {
return customLoaderName;
}
public void setCustomLoaderName(String customLoaderName) {
this.customLoaderName = customLoaderName;
}
@Override
public CustomSQL getCustomInsert() {
return customInsert;
}
public void setCustomInsert(CustomSQL customInsert) {
this.customInsert = customInsert;
}
@Override
public CustomSQL getCustomUpdate() {
return customUpdate;
}
public void setCustomUpdate(CustomSQL customUpdate) {
this.customUpdate = customUpdate;
}
@Override
public CustomSQL getCustomDelete() {
return customDelete;
}
public void setCustomDelete(CustomSQL customDelete) {
this.customDelete = customDelete;
}
@Override
public Set<String> getSynchronizedTableNames() {
return synchronizedTableNames;
}
public void addSynchronizedTableName(String tableName) {
synchronizedTableNames.add( tableName );
}
@Override
public MetaAttributeContext getMetaAttributeContext() {
// not needed for annotations!? (HF)
// probably not; this is a tools/generation thing (SE)
return null;
}
@Override
public Origin getOrigin() {
// (steve) - not sure how to best handle this. Origin should essentially name the class file from which
// this information came
return null;
}
@Override
public UnifiedDescriptorObject getContainingDescriptor() {
// probably makes most sense as none for annotations.
return this;
}
}

View File

@ -1,141 +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.source.annotations.entity.state.binding;
import org.hibernate.annotations.OptimisticLockType;
import org.hibernate.engine.OptimisticLockStyle;
import org.hibernate.metamodel.binder.source.BindingContext;
import org.hibernate.metamodel.binder.source.RootEntityDescriptor;
import org.hibernate.metamodel.binder.source.TableDescriptor;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClass;
import org.hibernate.metamodel.binding.Caching;
import org.hibernate.metamodel.binding.InheritanceType;
/**
* @author Steve Ebersole
* @author Hardy Ferentschik
*/
public class RootEntityDescriptorImpl
extends AbstractEntityDescriptorImpl
implements RootEntityDescriptor {
private boolean mutable;
private boolean explicitPolymorphism;
private String whereFilter;
private String rowId;
private OptimisticLockStyle optimisticLockStyle;
private Caching caching;
private TableDescriptor baseTableDescriptor;
public RootEntityDescriptorImpl(
ConfiguredClass configuredClass,
String superEntityName,
BindingContext bindingContext) {
super( configuredClass, superEntityName, bindingContext );
if ( configuredClass.getInheritanceType() != InheritanceType.NO_INHERITANCE ) {
// throw exception?
}
}
@Override
public boolean isMutable() {
return mutable;
}
public void setMutable(boolean mutable) {
this.mutable = mutable;
}
@Override
public boolean isExplicitPolymorphism() {
return explicitPolymorphism;
}
public void setExplicitPolymorphism(boolean explicitPolymorphism) {
this.explicitPolymorphism = explicitPolymorphism;
}
@Override
public String getWhereFilter() {
return whereFilter;
}
public void setWhereFilter(String whereFilter) {
this.whereFilter = whereFilter;
}
@Override
public String getRowId() {
return rowId;
}
public void setRowId(String rowId) {
this.rowId = rowId;
}
@Override
public OptimisticLockStyle getOptimisticLockStyle() {
return optimisticLockStyle;
}
public void setOptimisticLockType(OptimisticLockType optimisticLockType) {
switch ( optimisticLockType ) {
case NONE: {
this.optimisticLockStyle = OptimisticLockStyle.NONE;
break;
}
case DIRTY: {
this.optimisticLockStyle = OptimisticLockStyle.DIRTY;
break;
}
case ALL: {
this.optimisticLockStyle = OptimisticLockStyle.ALL;
break;
}
default: {
this.optimisticLockStyle = OptimisticLockStyle.VERSION;
}
}
}
@Override
public Caching getCaching() {
return caching;
}
public void setCaching(Caching caching) {
this.caching = caching;
}
@Override
public TableDescriptor getBaseTable() {
return baseTableDescriptor;
}
public void setBaseTableDescriptor(TableDescriptor baseTableDescriptor) {
this.baseTableDescriptor = baseTableDescriptor;
}
}

View File

@ -1,30 +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.source.annotations;
/**
* This code in this package is responsible for performing the process of preparing metadata from annotations
* and {@code orm.xml} into the forms needed by {@link org.hibernate.metamodel.binder.EntityBinder}. The main driver
* of this process is the {@link AnnotationsSourceProcessor} class.
*/

View File

@ -30,7 +30,7 @@ import java.util.List;
import java.util.Set;
import org.hibernate.MappingException;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.source.MetaAttributeContext;
import org.hibernate.metamodel.binding.state.AttributeBindingState;
import org.hibernate.metamodel.domain.Attribute;
import org.hibernate.metamodel.relational.Column;

View File

@ -25,7 +25,7 @@ package org.hibernate.metamodel.binding;
import java.util.Set;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.source.MetaAttributeContext;
import org.hibernate.metamodel.domain.Attribute;
import org.hibernate.metamodel.relational.SimpleValue;
import org.hibernate.metamodel.relational.Value;

View File

@ -34,7 +34,7 @@ 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.source.MetaAttributeContext;
import org.hibernate.metamodel.domain.Attribute;
import org.hibernate.metamodel.domain.Entity;
import org.hibernate.metamodel.relational.Column;

View File

@ -24,10 +24,9 @@
package org.hibernate.metamodel.binding;
import org.hibernate.mapping.PropertyGeneration;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.source.MetaAttributeContext;
import org.hibernate.metamodel.binding.state.SimpleAttributeBindingState;
import org.hibernate.metamodel.domain.SingularAttribute;
import org.hibernate.metamodel.relational.Value;
import org.hibernate.metamodel.relational.state.ColumnRelationalState;
import org.hibernate.metamodel.relational.state.ValueRelationalState;

View File

@ -26,7 +26,7 @@ package org.hibernate.metamodel.binding.state;
import java.util.Map;
import java.util.Set;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.source.MetaAttributeContext;
import org.hibernate.metamodel.binding.CascadeType;
/**

View File

@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.internal.util.Value;
/**
@ -100,15 +101,108 @@ public abstract class AbstractAttributeContainer implements AttributeContainer,
@Override
public SingularAttribute locateOrCreateComponentAttribute(String name) {
SingularAttribute attribute = (SingularAttribute) getAttribute( name );
SingularAttributeImpl attribute = (SingularAttributeImpl) getAttribute( name );
if ( attribute == null ) {
Component component = new Component( name, null );
ComponentAttributeContainerDelegate component = new ComponentAttributeContainerDelegate();
attribute = new SingularAttributeImpl( name, component );
component.singularAttribute = attribute;
addAttribute( attribute );
}
return attribute;
}
private static class ComponentAttributeContainerDelegate implements AttributeContainer {
private SingularAttributeImpl singularAttribute;
private ComponentAttributeContainerDelegate() {
}
private Component realComponent() {
if ( singularAttribute.getSingularAttributeType() == null ) {
throw new HibernateException( "Component type was not yet bound" );
}
if ( ! Component.class.isInstance( singularAttribute.getSingularAttributeType() ) ) {
throw new HibernateException( "Unexpected bound type for component attribute" );
}
return (Component) singularAttribute.getSingularAttributeType();
}
@Override
public Attribute getAttribute(String name) {
return realComponent().getAttribute( name );
}
@Override
public Set<Attribute> getAttributes() {
return realComponent().getAttributes();
}
@Override
public SingularAttribute locateOrCreateSingularAttribute(String name) {
return realComponent().locateOrCreateSingularAttribute( name );
}
@Override
public PluralAttribute locateOrCreatePluralAttribute(String name, PluralAttributeNature nature) {
return realComponent().locateOrCreatePluralAttribute( name, nature );
}
@Override
public PluralAttribute locateOrCreateBag(String name) {
return realComponent().locateOrCreateBag( name );
}
@Override
public PluralAttribute locateOrCreateSet(String name) {
return realComponent().locateOrCreateBag( name );
}
@Override
public IndexedPluralAttribute locateOrCreateList(String name) {
return realComponent().locateOrCreateList( name );
}
@Override
public IndexedPluralAttribute locateOrCreateMap(String name) {
return realComponent().locateOrCreateMap( name );
}
@Override
public SingularAttribute locateOrCreateComponentAttribute(String name) {
return realComponent().locateOrCreateComponentAttribute( name );
}
@Override
public String getName() {
return realComponent().getName();
}
@Override
public String getClassName() {
return realComponent().getClassName();
}
@Override
public Class<?> getClassReference() {
return realComponent().getClassReference();
}
@Override
public Value<Class<?>> getClassReferenceUnresolved() {
return realComponent().getClassReferenceUnresolved();
}
@Override
public boolean isAssociation() {
return realComponent().isAssociation();
}
@Override
public boolean isComponent() {
return realComponent().isComponent();
}
}
@Override
public PluralAttribute locateOrCreateBag(String name) {
return locateOrCreatePluralAttribute( name, PluralAttributeNature.BAG );

View File

@ -49,10 +49,11 @@ public interface AttributeContainer extends Type {
public Set<Attribute> getAttributes();
public SingularAttribute locateOrCreateSingularAttribute(String name);
public SingularAttribute locateOrCreateComponentAttribute(String name);
public PluralAttribute locateOrCreatePluralAttribute(String name, PluralAttributeNature nature);
public PluralAttribute locateOrCreateBag(String name);
public PluralAttribute locateOrCreateSet(String name);
public IndexedPluralAttribute locateOrCreateList(String name);
public IndexedPluralAttribute locateOrCreateMap(String name);
public SingularAttribute locateOrCreateComponentAttribute(String name);
}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source;
package org.hibernate.metamodel.source;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.internal.util.Value;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source;
package org.hibernate.metamodel.source;
import org.hibernate.cache.spi.access.AccessType;

View File

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder;
package org.hibernate.metamodel.source;
import org.hibernate.HibernateException;

View File

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder;
package org.hibernate.metamodel.source;
/**
* @author Steve Ebersole

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source;
package org.hibernate.metamodel.source;
import java.util.HashSet;
import java.util.Set;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source;
package org.hibernate.metamodel.source;
import org.hibernate.engine.ResultSetMappingDefinition;
import org.hibernate.engine.spi.FilterDefinition;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder;
package org.hibernate.metamodel.source;
import java.io.Serializable;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source;
package org.hibernate.metamodel.source;
import java.util.List;

View File

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder;
package org.hibernate.metamodel.source;
/**
* From where did the metadata come from?

View File

@ -22,7 +22,7 @@
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder;
package org.hibernate.metamodel.source;
import org.hibernate.HibernateException;

View File

@ -21,14 +21,14 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import com.fasterxml.classmate.ResolvedType;
import com.fasterxml.classmate.ResolvedTypeWithMembers;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.Index;
import org.hibernate.metamodel.binder.source.BindingContext;
import org.hibernate.metamodel.source.BindingContext;
/**
* @author Steve Ebersole

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import java.io.IOException;
import java.io.InputStream;
@ -45,22 +45,22 @@ import org.hibernate.HibernateException;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.MetadataSources;
import org.hibernate.metamodel.binder.source.MappingDefaults;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.SourceProcessor;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClassHierarchy;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClassType;
import org.hibernate.metamodel.binder.source.annotations.entity.EntityBinder;
import org.hibernate.metamodel.binder.source.annotations.global.FetchProfileBinder;
import org.hibernate.metamodel.binder.source.annotations.global.FilterDefBinder;
import org.hibernate.metamodel.binder.source.annotations.global.IdGeneratorBinder;
import org.hibernate.metamodel.binder.source.annotations.global.QueryBinder;
import org.hibernate.metamodel.binder.source.annotations.global.TableBinder;
import org.hibernate.metamodel.binder.source.annotations.global.TypeDefBinder;
import org.hibernate.metamodel.binder.source.annotations.xml.PseudoJpaDotNames;
import org.hibernate.metamodel.binder.source.annotations.xml.mocker.EntityMappingsMocker;
import org.hibernate.metamodel.binder.source.internal.JaxbRoot;
import org.hibernate.metamodel.binder.source.internal.MetadataImpl;
import org.hibernate.metamodel.source.MappingDefaults;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.SourceProcessor;
import org.hibernate.metamodel.source.annotations.entity.ConfiguredClassHierarchy;
import org.hibernate.metamodel.source.annotations.entity.ConfiguredClassType;
import org.hibernate.metamodel.source.annotations.entity.EntityBinder;
import org.hibernate.metamodel.source.annotations.global.FetchProfileBinder;
import org.hibernate.metamodel.source.annotations.global.FilterDefBinder;
import org.hibernate.metamodel.source.annotations.global.IdGeneratorBinder;
import org.hibernate.metamodel.source.annotations.global.QueryBinder;
import org.hibernate.metamodel.source.annotations.global.TableBinder;
import org.hibernate.metamodel.source.annotations.global.TypeDefBinder;
import org.hibernate.metamodel.source.annotations.xml.PseudoJpaDotNames;
import org.hibernate.metamodel.source.annotations.xml.mocker.EntityMappingsMocker;
import org.hibernate.metamodel.source.internal.JaxbRoot;
import org.hibernate.metamodel.source.internal.MetadataImpl;
import org.hibernate.metamodel.binding.EntityBinding;
import org.hibernate.metamodel.domain.Hierarchical;
import org.hibernate.metamodel.domain.Type;
@ -183,12 +183,22 @@ public class AnnotationsSourceProcessor implements SourceProcessor, AnnotationsB
// for classes annotated w/ @MappedSuperclass we just create the domain instance
// the attribute bindings will be part of the first entity subclass
else if ( ConfiguredClassType.MAPPED_SUPERCLASS.equals( entityClass.getConfiguredClassType() ) ) {
parent = new Superclass( entityClass.getName(), parent );
parent = new Superclass(
entityClass.getName(),
entityClass.getName(),
makeClassReference( entityClass.getName() ),
parent
);
}
// for classes which are not annotated at all we create the NonEntity domain class
// todo - not sure whether this is needed. It might be that we don't need this information (HF)
else {
parent = new NonEntity( entityClass.getName(), parent );
parent = new NonEntity(
entityClass.getName(),
entityClass.getName(),
makeClassReference( entityClass.getName() ),
parent
);
}
}
}

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import javax.persistence.AccessType;
import java.util.ArrayList;
@ -37,7 +37,7 @@ import org.jboss.jandex.DotName;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClassHierarchy;
import org.hibernate.metamodel.source.annotations.entity.ConfiguredClassHierarchy;
import org.hibernate.metamodel.source.annotations.entity.EmbeddableClass;
import org.hibernate.metamodel.source.annotations.entity.EntityClass;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import org.jboss.jandex.DotName;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import javax.persistence.Access;
import javax.persistence.AccessType;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import java.beans.Introspector;
import java.io.IOException;

View File

@ -1,4 +1,4 @@
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import java.beans.Introspector;
import java.lang.reflect.Field;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations;
package org.hibernate.metamodel.source.annotations;
import org.hibernate.HibernateException;

View File

@ -34,8 +34,8 @@ import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.DotName;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
/**
* @author Hardy Ferentschik

View File

@ -31,7 +31,7 @@ import org.jboss.jandex.DotName;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.util.JandexHelper;
import org.hibernate.metamodel.source.annotations.JandexHelper;
/**
* Container for the properties of a discriminator column.

View File

@ -35,9 +35,9 @@ import org.jboss.jandex.DotName;
import org.hibernate.AnnotationException;
import org.hibernate.annotations.GenerationTime;
import org.hibernate.mapping.PropertyGeneration;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
/**
* Represent a mapped attribute (explicitly or implicitly mapped). Also used for synthetic attributes like a

View File

@ -27,7 +27,7 @@ import java.util.Map;
import java.util.Set;
import org.hibernate.mapping.PropertyGeneration;
import org.hibernate.metamodel.binder.source.MetaAttributeContext;
import org.hibernate.metamodel.source.MetaAttributeContext;
import org.hibernate.metamodel.binding.CascadeType;
import org.hibernate.metamodel.binding.state.SimpleAttributeBindingState;
import org.hibernate.metamodel.source.annotations.attribute.SimpleAttribute;

View File

@ -33,7 +33,7 @@ import org.jboss.jandex.AnnotationInstance;
import org.hibernate.AnnotationException;
import org.hibernate.cfg.NamingStrategy;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.relational.Size;
import org.hibernate.metamodel.relational.state.ColumnRelationalState;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.entity;
package org.hibernate.metamodel.source.annotations.entity;
import javax.persistence.AccessType;
import java.lang.reflect.Field;
@ -52,17 +52,16 @@ import org.jboss.logging.Logger;
import org.hibernate.AnnotationException;
import org.hibernate.AssertionFailure;
import org.hibernate.HibernateException;
import org.hibernate.metamodel.binder.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.binder.source.annotations.ConfiguredClassHierarchyBuilder;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.binder.source.annotations.ReflectionHelper;
import org.hibernate.metamodel.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.source.annotations.ConfiguredClassHierarchyBuilder;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.annotations.ReflectionHelper;
import org.hibernate.metamodel.source.annotations.attribute.AssociationAttribute;
import org.hibernate.metamodel.source.annotations.attribute.AttributeOverride;
import org.hibernate.metamodel.source.annotations.attribute.AttributeType;
import org.hibernate.metamodel.source.annotations.attribute.MappedAttribute;
import org.hibernate.metamodel.source.annotations.attribute.SimpleAttribute;
import org.hibernate.metamodel.source.annotations.entity.EmbeddableClass;
/**
* Base class for a configured entity, mapped super class or embeddable

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.entity;
package org.hibernate.metamodel.source.annotations.entity;
import javax.persistence.AccessType;
import java.util.ArrayList;
@ -34,12 +34,10 @@ import org.jboss.jandex.FieldInfo;
import org.jboss.jandex.MethodInfo;
import org.hibernate.AnnotationException;
import org.hibernate.metamodel.binder.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.binding.InheritanceType;
import org.hibernate.metamodel.source.annotations.entity.EmbeddableClass;
import org.hibernate.metamodel.source.annotations.entity.EntityClass;
/**
* Contains information about the access and inheritance type for all classes within a class hierarchy.

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.entity;
package org.hibernate.metamodel.source.annotations.entity;
/**
* @author Hardy Ferentschik

View File

@ -27,8 +27,7 @@ import javax.persistence.AccessType;
import org.jboss.jandex.ClassInfo;
import org.hibernate.metamodel.binder.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClass;
import org.hibernate.metamodel.source.annotations.AnnotationsBindingContext;
/**
* @author Hardy Ferentschik

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.entity;
package org.hibernate.metamodel.source.annotations.entity;
import javax.persistence.GenerationType;
import java.util.Arrays;
@ -47,12 +47,12 @@ import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.internal.util.Value;
import org.hibernate.metamodel.binder.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.binder.source.annotations.UnknownInheritanceTypeException;
import org.hibernate.metamodel.binder.source.annotations.global.IdGeneratorBinder;
import org.hibernate.metamodel.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.annotations.UnknownInheritanceTypeException;
import org.hibernate.metamodel.source.annotations.global.IdGeneratorBinder;
import org.hibernate.metamodel.binding.Caching;
import org.hibernate.metamodel.binding.CustomSQL;
import org.hibernate.metamodel.binding.EntityBinding;
@ -84,8 +84,6 @@ import org.hibernate.metamodel.source.annotations.attribute.state.binding.ManyTo
import org.hibernate.metamodel.source.annotations.attribute.state.relational.ColumnRelationalStateImpl;
import org.hibernate.metamodel.source.annotations.attribute.state.relational.ManyToOneRelationalStateImpl;
import org.hibernate.metamodel.source.annotations.attribute.state.relational.TupleRelationalStateImpl;
import org.hibernate.metamodel.source.annotations.entity.EmbeddableClass;
import org.hibernate.metamodel.source.annotations.entity.EntityClass;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.tuple.entity.EntityTuplizer;
@ -152,7 +150,6 @@ public class EntityBinder {
bindTableUniqueConstraints( entityBinding );
bindingContext.getMetadataImplementor().addEntity( entityBinding );
return entityBinding;
}
@ -877,7 +874,7 @@ public class EntityBinder {
}
String attributeName = simpleAttribute.getName();
SingularAttribute attribute = entityBinding.getEntity().locateOrCreateSingularAttribute( attributeName );
SingularAttribute attribute = container.locateOrCreateSingularAttribute( attributeName );
SimpleAttributeBinding attributeBinding;
if ( simpleAttribute.isDiscriminator() ) {

View File

@ -33,11 +33,8 @@ import org.jboss.jandex.DotName;
import org.hibernate.AnnotationException;
import org.hibernate.MappingException;
import org.hibernate.metamodel.binder.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClass;
import org.hibernate.metamodel.binder.source.annotations.entity.ConfiguredClassType;
import org.hibernate.metamodel.binder.source.annotations.entity.IdType;
import org.hibernate.metamodel.source.annotations.AnnotationsBindingContext;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.binding.InheritanceType;
/**

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.entity;
package org.hibernate.metamodel.source.annotations.entity;
/**
* An emum for the type of id configuration for an entity.

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.global;
package org.hibernate.metamodel.source.annotations.global;
import java.util.HashSet;
import java.util.Set;
@ -32,11 +32,11 @@ import org.jboss.jandex.Index;
import org.hibernate.MappingException;
import org.hibernate.annotations.FetchMode;
import org.hibernate.annotations.FetchProfiles;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.binding.FetchProfile;
import org.hibernate.metamodel.binding.FetchProfile.Fetch;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
/**
* Binds fetch profiles found in annotations.

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.global;
package org.hibernate.metamodel.source.annotations.global;
import java.util.HashMap;
import java.util.Map;
@ -34,9 +34,9 @@ import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.FilterDefs;
import org.hibernate.engine.spi.FilterDefinition;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.type.Type;
public class FilterDefBinder {

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.global;
package org.hibernate.metamodel.source.annotations.global;
import java.util.HashMap;
import java.util.Map;
@ -44,11 +44,11 @@ import org.hibernate.id.enhanced.SequenceStyleGenerator;
import org.hibernate.id.enhanced.TableGenerator;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.binding.IdGenerator;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
public class IdGeneratorBinder {

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.global;
package org.hibernate.metamodel.source.annotations.global;
import java.util.HashMap;
import javax.persistence.NamedNativeQueries;
@ -45,10 +45,10 @@ import org.hibernate.engine.spi.NamedQueryDefinition;
import org.hibernate.engine.spi.NamedSQLQueryDefinition;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
public class QueryBinder {

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.global;
package org.hibernate.metamodel.source.annotations.global;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.Index;
@ -30,14 +30,14 @@ import org.jboss.logging.Logger;
import org.hibernate.AnnotationException;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.relational.Column;
import org.hibernate.metamodel.relational.ObjectName;
import org.hibernate.metamodel.relational.Schema;
import org.hibernate.metamodel.relational.SimpleValue;
import org.hibernate.metamodel.relational.Table;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
/**
* Binds table related information. This binder is called after the entities are bound.

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.global;
package org.hibernate.metamodel.source.annotations.global;
import java.util.HashMap;
import java.util.Map;
@ -34,10 +34,10 @@ import org.hibernate.AnnotationException;
import org.hibernate.annotations.TypeDefs;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.binding.TypeDef;
import org.hibernate.metamodel.binder.source.annotations.HibernateDotNames;
import org.hibernate.metamodel.source.annotations.HibernateDotNames;
public class TypeDefBinder {

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml;
package org.hibernate.metamodel.source.annotations.xml;
import org.jboss.jandex.DotName;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.filter;
package org.hibernate.metamodel.source.annotations.xml.filter;
import java.util.Arrays;
import java.util.HashSet;
@ -32,7 +32,7 @@ import java.util.Set;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.DotName;
import org.hibernate.metamodel.binder.source.annotations.xml.mocker.IndexBuilder;
import org.hibernate.metamodel.source.annotations.xml.mocker.IndexBuilder;
/**
* @author Strong Liu

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.filter;
package org.hibernate.metamodel.source.annotations.xml.filter;
import java.util.ArrayList;
import java.util.Collections;
@ -35,7 +35,7 @@ import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.DotName;
import org.hibernate.metamodel.binder.source.annotations.xml.mocker.MockHelper;
import org.hibernate.metamodel.source.annotations.xml.mocker.MockHelper;
/**
* @author Strong Liu

View File

@ -21,13 +21,13 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.filter;
package org.hibernate.metamodel.source.annotations.xml.filter;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.DotName;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.binder.source.annotations.xml.mocker.IndexBuilder;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.xml.mocker.IndexBuilder;
/**
* @author Strong Liu

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.filter;
package org.hibernate.metamodel.source.annotations.xml.filter;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.filter;
package org.hibernate.metamodel.source.annotations.xml.filter;
import java.util.Iterator;
import java.util.List;
@ -30,7 +30,7 @@ import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.DotName;
import org.hibernate.metamodel.binder.source.annotations.xml.mocker.MockHelper;
import org.hibernate.metamodel.source.annotations.xml.mocker.MockHelper;
/**
* @author Strong Liu

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;
@ -33,7 +33,7 @@ import org.jboss.jandex.DotName;
import org.hibernate.metamodel.source.annotation.xml.XMLAccessType;
import org.hibernate.metamodel.source.annotation.xml.XMLUniqueConstraint;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
/**
* Base class for the mock jandex annotations created from orm.xml.

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.List;
import java.util.Map;
@ -36,10 +36,10 @@ import org.jboss.logging.Logger;
import org.hibernate.AssertionFailure;
import org.hibernate.MappingException;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.binder.source.annotations.xml.PseudoJpaDotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.annotations.xml.PseudoJpaDotNames;
import org.hibernate.metamodel.source.annotation.xml.XMLAccessType;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
/**
* @author Strong Liu

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.HashSet;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;
@ -34,13 +34,13 @@ import org.jboss.logging.Logger;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.binder.source.annotations.JandexHelper;
import org.hibernate.metamodel.binder.source.annotations.xml.filter.IndexedAnnotationFilter;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JandexHelper;
import org.hibernate.metamodel.source.annotations.xml.filter.IndexedAnnotationFilter;
import org.hibernate.metamodel.source.annotation.xml.XMLEmbeddable;
import org.hibernate.metamodel.source.annotation.xml.XMLEntity;
import org.hibernate.metamodel.source.annotation.xml.XMLMappedSuperclass;
import org.hibernate.metamodel.source.annotation.xml.XMLTable;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
/**
* @author Strong Liu

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.Collections;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.jboss.logging.Logger;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.jboss.jandex.ClassInfo;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.jboss.jandex.ClassInfo;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.io.Serializable;
import java.util.ArrayList;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.Collection;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.HashMap;
@ -37,7 +37,7 @@ import org.jboss.logging.Logger;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.binder.MappingException;
import org.hibernate.metamodel.source.MappingException;
import org.hibernate.metamodel.source.annotation.xml.XMLAttributes;
import org.hibernate.metamodel.source.annotation.xml.XMLEntity;
import org.hibernate.metamodel.source.annotation.xml.XMLEntityMappings;
@ -47,7 +47,7 @@ import org.hibernate.metamodel.source.annotation.xml.XMLNamedQuery;
import org.hibernate.metamodel.source.annotation.xml.XMLSequenceGenerator;
import org.hibernate.metamodel.source.annotation.xml.XMLSqlResultSetMapping;
import org.hibernate.metamodel.source.annotation.xml.XMLTableGenerator;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
/**
* @author Strong Liu

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.Collections;
@ -38,7 +38,7 @@ import org.jboss.logging.Logger;
import org.hibernate.AssertionFailure;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.binder.source.annotations.xml.filter.IndexedAnnotationFilter;
import org.hibernate.metamodel.source.annotations.xml.filter.IndexedAnnotationFilter;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.classloading.spi.ClassLoaderService;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.jboss.logging.Logger;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.beans.Introspector;
import java.lang.reflect.Field;
@ -42,7 +42,7 @@ import org.jboss.jandex.Type;
import org.hibernate.HibernateException;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.metamodel.source.annotation.xml.XMLCascadeType;
import org.hibernate.metamodel.binder.source.annotations.JPADotNames;
import org.hibernate.metamodel.source.annotations.JPADotNames;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.classloading.spi.ClassLoaderService;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,4 @@
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.HashMap;
import java.util.Map;
@ -9,7 +9,7 @@ import org.jboss.jandex.AnnotationValue;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.hibernate.metamodel.binder.source.annotations.xml.PseudoJpaDotNames;
import org.hibernate.metamodel.source.annotations.xml.PseudoJpaDotNames;
import org.hibernate.metamodel.source.annotation.xml.XMLPersistenceUnitDefaults;
/**

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import java.util.ArrayList;
import java.util.List;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.hibernate.metamodel.source.annotation.xml.XMLCollectionTable;
import org.hibernate.metamodel.source.annotation.xml.XMLJoinTable;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.jboss.jandex.ClassInfo;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.annotations.xml.mocker;
package org.hibernate.metamodel.source.annotations.xml.mocker;
import org.jboss.jandex.ClassInfo;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.hbm;
package org.hibernate.metamodel.source.hbm;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -21,7 +21,7 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.metamodel.binder.source.hbm;
package org.hibernate.metamodel.source.hbm;
import java.beans.BeanInfo;
import java.beans.PropertyDescriptor;
@ -37,11 +37,12 @@ import org.hibernate.engine.OptimisticLockStyle;
import org.hibernate.internal.util.Value;
import org.hibernate.internal.util.beans.BeanInfoHelper;
import org.hibernate.mapping.PropertyGeneration;
import org.hibernate.metamodel.binder.MappingException;
import org.hibernate.metamodel.binder.source.MetadataImplementor;
import org.hibernate.metamodel.binder.source.hbm.xml.mapping.EntityElement;
import org.hibernate.metamodel.binder.source.hbm.xml.mapping.JoinElementSource;
import org.hibernate.metamodel.binder.source.hbm.xml.mapping.SubEntityElement;
import org.hibernate.metamodel.domain.SingularAttribute;
import org.hibernate.metamodel.source.MappingException;
import org.hibernate.metamodel.source.MetadataImplementor;
import org.hibernate.metamodel.source.annotations.attribute.SimpleAttribute;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.EntityElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.JoinElementSource;
import org.hibernate.metamodel.binding.BagBinding;
import org.hibernate.metamodel.binding.Caching;
import org.hibernate.metamodel.binding.EntityBinding;
@ -58,31 +59,31 @@ import org.hibernate.metamodel.relational.SimpleValue;
import org.hibernate.metamodel.relational.Size;
import org.hibernate.metamodel.relational.TableSpecification;
import org.hibernate.metamodel.relational.Tuple;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLAnyElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLBagElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLCacheElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLColumnElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLComponentElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLDynamicComponentElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLHibernateMapping;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLIdbagElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLJoinElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLJoinedSubclassElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLListElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLManyToOneElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLMapElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLOneToOneElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLParamElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertiesElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLPropertyElement;
import org.hibernate.metamodel.source.hbm.xml.mapping.XMLSetElement;
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.metamodel.source.hbm.jaxb.mapping.XMLAnyElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLBagElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLCacheElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLColumnElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLComponentElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLDynamicComponentElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLHibernateMapping;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLIdbagElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLJoinElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLJoinedSubclassElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLListElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLManyToOneElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLMapElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLOneToOneElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLParamElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLPropertiesElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLPropertyElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLSetElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLSqlDeleteElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLSqlInsertElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLSqlUpdateElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLSubclassElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLSynchronizeElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLTuplizerElement;
import org.hibernate.metamodel.source.hbm.jaxb.mapping.XMLUnionSubclassElement;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.tuple.entity.EntityTuplizer;
@ -601,7 +602,8 @@ public class BindingCreator {
}
private void bindProperty(XMLPropertyElement property, EntityBinding entityBinding) {
SimpleAttributeBinding attributeBinding = entityBinding.makeSimpleAttributeBinding( property.getName() );
SingularAttribute attr = entityBinding.getEntity().locateOrCreateSingularAttribute( property.getName() );
SimpleAttributeBinding attributeBinding = entityBinding.makeSimpleAttributeBinding( attr );
resolveTypeInformation( property, attributeBinding );
attributeBinding.setInsertable( Helper.getBooleanValue( property.isInsert(), true ) );
@ -840,7 +842,7 @@ public class BindingCreator {
private void bindSecondaryTables(EntitySourceInformation entitySourceInfo, EntityBinding entityBinding) {
final EntityElement entityElement = entitySourceInfo.getEntityElement();
if ( ! ( entityElement instanceof JoinElementSource ) ) {
if ( ! ( entityElement instanceof JoinElementSource) ) {
return;
}

Some files were not shown because too many files have changed in this diff Show More