From 9bce5e0643e6ff023bcd6424c352fa9d9dd3858c Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Fri, 24 Aug 2012 22:56:55 +0800 Subject: [PATCH] HHH-7549 @OneToMany support --- .../main/java/org/hibernate/CacheMode.java | 2 - .../hibernate/InvalidMappingException.java | 2 +- .../org/hibernate/StoredProcedureCall.java | 3 +- .../action/internal/EntityDeleteAction.java | 2 - .../annotations/SqlFragmentAlias.java | 6 +- .../internal/NoCachingRegionFactory.java | 1 - .../cache/internal/StandardQueryCache.java | 2 - .../cfg/AttributeConverterDefinition.java | 2 +- .../java/org/hibernate/cfg/HbmBinder.java | 1 - .../main/java/org/hibernate/cfg/Mappings.java | 1 - .../org/hibernate/cfg/SettingsFactory.java | 2 +- .../cfg/annotations/CollectionBinder.java | 10 +- .../cfg/annotations/EntityBinder.java | 10 +- .../cfg/annotations/QueryBinder.java | 2 +- .../cfg/annotations/SimpleValueBinder.java | 6 +- .../AbstractPersistentCollection.java | 2 +- .../java/org/hibernate/dialect/Dialect.java | 2 +- .../java/org/hibernate/dialect/H2Dialect.java | 9 +- .../dialect/SybaseASE157Dialect.java | 5 - .../dialect/pagination/LimitHandler.java | 2 - .../hibernate/engine/internal/Cascade.java | 1 - .../internal/StatefulPersistenceContext.java | 1 - .../jdbc/internal/LogicalConnectionImpl.java | 2 +- .../engine/jdbc/spi/JdbcServices.java | 4 +- .../hibernate/engine/spi/CacheInitiator.java | 2 +- .../engine/spi/SessionFactoryImplementor.java | 2 +- .../engine/spi/SessionImplementor.java | 2 +- .../engine/spi/SyntheticAttributeHelper.java | 2 - .../internal/jta/JtaIsolationDelegate.java | 4 +- .../DefaultResolveNaturalIdEventListener.java | 1 - .../ast/tree/AbstractMapComponentNode.java | 1 - .../org/hibernate/id/SequenceGenerator.java | 1 - .../id/SequenceIdentityGenerator.java | 3 - .../java/org/hibernate/id/TableGenerator.java | 1 - .../id/enhanced/SequenceStyleGenerator.java | 2 - .../hibernate/id/enhanced/TableGenerator.java | 1 - .../AbstractBasicQueryContractImpl.java | 3 - .../internal/AbstractSessionImpl.java | 2 +- .../internal/FilterConfiguration.java | 1 - .../internal/SessionFactoryImpl.java | 10 +- .../org/hibernate/internal/SessionImpl.java | 5 +- .../internal/StoredProcedureCallImpl.java | 6 +- .../internal/StoredProcedureOutputsImpl.java | 3 - .../internal/JaxbConfigurationProcessor.java | 2 +- .../internal/NamespaceAddingEventReader.java | 6 +- .../jpa/metamodel/internal/MetamodelImpl.java | 8 +- .../internal/builder/AttributeBuilder.java | 35 ++-- .../internal/builder/AttributeMetadata.java | 2 +- .../builder/BaseAttributeMetadata.java | 2 +- .../internal/builder/MetamodelBuilder.java | 11 +- .../builder/PluralAttributeMetadataImpl.java | 4 +- .../SingularAttributeMetadataImpl.java | 2 +- .../internal/legacy/AbstractAttribute.java | 4 +- .../legacy/AbstractIdentifiableType.java | 6 +- .../internal/legacy/AbstractManagedType.java | 10 +- .../internal/legacy/AbstractType.java | 2 +- .../internal/legacy/AttributeFactory.java | 13 +- .../internal/legacy/BasicTypeImpl.java | 2 +- .../internal/legacy/EmbeddableTypeImpl.java | 2 +- .../internal/legacy/EntityTypeImpl.java | 2 +- .../internal/legacy/MetadataContext.java | 8 +- .../internal/legacy/MetamodelImpl.java | 10 +- .../internal/legacy/PluralAttributeImpl.java | 12 +- .../legacy/SingularAttributeImpl.java | 4 +- .../org/hibernate/mapping/SimpleValue.java | 2 +- .../hibernate/metamodel/MetadataSources.java | 3 +- .../hibernate/metamodel/internal/Binder.java | 65 ++++---- .../metamodel/internal/MetadataImpl.java | 7 +- .../internal/SessionFactoryBuilderImpl.java | 4 +- .../AnnotationBindingContextImpl.java | 1 - .../ComponentAttributeSourceImpl.java | 11 +- .../annotations/DerivedValueSourceImpl.java | 1 - .../source/annotations/EntitySourceImpl.java | 16 +- ...IdentifierGeneratorExtractionDelegate.java | 3 +- .../IdentifierGeneratorSourceContainer.java | 1 - .../IndexedPluralAttributeSourceImpl.java | 37 +++++ ...oManyPluralAttributeElementSourceImpl.java | 7 +- ...oManyPluralAttributeElementSourceImpl.java | 20 +-- .../PluralAttributeIndexSourceImpl.java | 61 +++++++ .../PluralAttributeKeySourceImpl.java | 35 ++-- .../PluralAttributeSourceImpl.java | 143 +++++++++++++---- .../SingularAttributeSourceImpl.java | 5 +- .../annotations/ToOneAttributeSourceImpl.java | 8 +- .../attribute/AssociationAttribute.java | 39 +---- .../attribute/AttributeNature.java | 57 ------- .../annotations/attribute/BasicAttribute.java | 8 +- .../attribute/MappedAttribute.java | 37 ++++- .../attribute/PluralAssociationAttribute.java | 73 ++++++++- .../type/AttributeTypeResolverImpl.java | 2 +- .../type/EnumeratedTypeResolver.java | 2 +- .../type/ExplicitHibernateTypeSourceImpl.java | 1 - .../attribute/type/LobTypeResolver.java | 2 +- .../attribute/type/TemporalTypeResolver.java | 2 +- .../annotations/entity/ConfiguredClass.java | 31 ++-- .../entity/EmbeddableHierarchy.java | 3 - .../entity/EntityBindingContext.java | 7 +- .../global/IdGeneratorProcessor.java | 5 +- .../annotations/global/QueryProcessor.java | 5 +- .../global/SqlResultSetProcessor.java | 1 - .../annotations/global/TableProcessor.java | 1 - .../util/EntityHierarchyBuilder.java | 2 +- .../util/EnumConversionHelper.java | 12 +- .../annotations/util/HibernateDotNames.java | 2 +- .../xml/mocker/AbstractMocker.java | 2 +- .../annotations/xml/mocker/AccessHelper.java | 2 +- .../xml/mocker/AnnotationMocker.java | 2 +- .../mocker/DefaultConfigurationHelper.java | 2 +- .../xml/mocker/EntityMappingsMocker.java | 1 - .../annotations/xml/mocker/EntityMocker.java | 4 +- .../xml/mocker/GlobalAnnotationMocker.java | 2 +- .../xml/mocker/GlobalAnnotations.java | 4 +- .../annotations/xml/mocker/IndexBuilder.java | 1 - .../annotations/xml/mocker/MockHelper.java | 3 +- .../xml/mocker/PropertyMocker.java | 2 +- .../AbstractComponentAttributeSourceImpl.java | 7 +- .../source/hbm/AbstractEntitySourceImpl.java | 2 +- .../source/hbm/AbstractHbmSourceNode.java | 2 +- .../AbstractPluralAttributeSourceImpl.java | 4 +- .../source/hbm/BagAttributeSourceImpl.java | 7 +- ...BasicPluralAttributeElementSourceImpl.java | 5 +- .../hbm/ComponentAttributeSourceImpl.java | 2 +- ...ositePluralAttributeElementSourceImpl.java | 11 +- .../source/hbm/EntityHierarchyImpl.java | 2 +- .../internal/source/hbm/FilterSourceImpl.java | 2 +- .../hbm/HbmMetadataSourceProcessorImpl.java | 2 +- .../metamodel/internal/source/hbm/Helper.java | 10 +- .../source/hbm/ListAttributeIndexSource.java | 5 +- .../source/hbm/ListAttributeSource.java | 7 +- ...oManyPluralAttributeElementSourceImpl.java | 7 +- .../hbm/ManyToOneAttributeSourceImpl.java | 5 +- .../source/hbm/MapAttributeIndexSource.java | 9 +- .../source/hbm/MapAttributeSource.java | 7 +- .../internal/source/hbm/MappingDocument.java | 2 +- ...oManyPluralAttributeElementSourceImpl.java | 7 +- .../hbm/PropertyAttributeSourceImpl.java | 5 +- .../source/hbm/RootEntitySourceImpl.java | 4 +- .../source/hbm/SetAttributeSourceImpl.java | 7 +- ...SingularIdentifierAttributeSourceImpl.java | 5 +- .../hbm/TimestampAttributeSourceImpl.java | 7 +- .../hbm/VersionAttributeSourceImpl.java | 7 +- .../spi/MetadataSourceProcessor.java | 1 - ...ralAttributeAssociationElementBinding.java | 3 - .../AbstractPluralAttributeBinding.java | 27 ++-- .../binding/AttributeBindingContainer.java | 10 +- .../metamodel/spi/binding/BagBinding.java | 2 +- .../BasicPluralAttributeElementBinding.java | 6 +- .../BasicPluralAttributeIndexBinding.java | 10 +- .../binding/CompositeAttributeBinding.java | 19 ++- ...ompositePluralAttributeElementBinding.java | 6 +- .../metamodel/spi/binding/EntityBinding.java | 19 ++- .../metamodel/spi/binding/EntityVersion.java | 2 - .../metamodel/spi/binding/Helper.java | 3 +- .../metamodel/spi/binding/ListBinding.java | 4 +- ...anyToAnyPluralAttributeElementBinding.java | 6 +- ...nyToManyPluralAttributeElementBinding.java | 7 +- .../metamodel/spi/binding/MapBinding.java | 4 +- ...neToManyPluralAttributeElementBinding.java | 6 +- .../PluralAttributeElementBinding.java | 45 +++++- .../binding/PluralAttributeElementNature.java | 67 -------- .../binding/PluralAttributeIndexBinding.java | 28 +++- .../binding/PluralAttributeIndexNature.java | 48 ------ .../binding/PluralAttributeKeyBinding.java | 1 - .../metamodel/spi/binding/SetBinding.java | 2 +- .../domain/AbstractAttributeContainer.java | 18 +-- .../metamodel/spi/domain/PluralAttribute.java | 45 +++++- .../spi/domain/PluralAttributeNature.java | 67 -------- .../metamodel/spi/relational/Index.java | 3 +- .../spi/source/FetchProfileSource.java | 2 - .../source/PluralAttributeElementNature.java | 37 ----- .../source/PluralAttributeElementSource.java | 15 +- .../source/PluralAttributeIndexNature.java | 38 ----- .../source/PluralAttributeIndexSource.java | 16 +- .../spi/source/PluralAttributeNature.java | 52 ------ .../spi/source/PluralAttributeSource.java | 30 +++- .../spi/source/SingularAttributeNature.java | 37 ----- .../spi/source/SingularAttributeSource.java | 14 +- .../AbstractCollectionPersister.java | 12 +- .../collection/OneToManyPersister.java | 10 +- .../entity/AbstractEntityPersister.java | 3 +- .../StandardPersisterClassResolver.java | 6 +- .../persister/spi/PersisterFactory.java | 2 +- .../proxy/AbstractLazyInitializer.java | 2 +- .../org/hibernate/service/ConfigLoader.java | 6 +- .../service/ServiceRegistryBuilder.java | 2 +- .../service/StandardServiceInitiators.java | 1 - .../spi/StrategyInstanceResolver.java | 2 - .../internal/JdbcEnvironmentInitiator.java | 1 - .../NormalizingIdentifierHelperImpl.java | 4 +- .../env/spi/ExtractedDatabaseMetaData.java | 5 - .../internal/DatabaseInformationImpl.java | 4 +- .../schema/internal/SchemaValidatorImpl.java | 2 +- .../schema/internal/TableInformationImpl.java | 1 - .../service/schema/spi/TableInformation.java | 2 - .../ordering/antlr/OrderByFragmentParser.java | 1 - .../DynamicMapComponentTuplizer.java | 151 +++++++++--------- .../component/PojoComponentTuplizer.java | 3 +- .../tuple/entity/EntityMetamodel.java | 1 - .../java/org/hibernate/type/EnumType.java | 4 +- .../java/JavaTypeDescriptorRegistry.java | 1 - .../main/xjb/hbm-configuration-bindings.xjb | 3 +- .../src/main/xjb/hbm-mapping-bindings.xjb | 7 +- hibernate-core/src/main/xjb/orm-bindings.xjb | 7 +- .../cache/spi/NaturalIdCacheKeyTest.java | 27 ++-- .../dialect/PostgreSQL81DialectTestCase.java | 6 +- .../internal/source/AssertSourcesTest.java | 8 +- .../metamodel/internal/source/User.java | 2 +- .../entity/EmbeddableBindingTest.java | 4 +- .../entity/IdentifierGeneratorTest.java | 1 - .../entity/NaturalIdBindingTests.java | 8 +- .../entity/OneToManyBindingTest.java | 33 ++++ .../entity/SecondaryTableTest.java | 4 +- .../global/FetchProfileBinderTest.java | 8 +- .../annotations/xml/OrmXmlParserTests.java | 2 +- .../binding/AbstractBasicBindingTests.java | 14 +- .../binding/BasicCollectionBindingTests.java | 10 +- .../binding/EntityWithBasicCollections.java | 1 - .../binding/JoinedSubclassBindingTests.java | 14 +- .../UnidirectionalManyToManyBindingTests.java | 1 - .../UnidirectionalOneToManyBindingTests.java | 6 +- .../AbstractConstraintNameTests.java | 1 - .../AbstractGeneratedIdColumnTests.java | 1 - .../spi/relational/ColumnAliasTest.java | 8 +- .../ForeignKeyConstraintNameTests.java | 5 - .../spi/relational/ObjectNameTests.java | 1 - .../PrimaryKeyConstraintNameTests.java | 1 - .../relational/TableManipulationTests.java | 1 - .../SessionWithSharedConnectionTest.java | 24 +-- .../java/org/hibernate/sql/TemplateTest.java | 3 +- .../ordered/ElementCollectionSortingTest.java | 3 +- .../collectionelement/ordered/Person.java | 5 +- .../embeddables/DollarValueUserType.java | 1 - .../embeddables/EmbeddableIntegratorTest.java | 7 +- .../annotations/embeddables/Investor.java | 1 - .../annotations/embedded/EmbeddedTest.java | 1 - .../HibernateAnnotationMappingTest.java | 7 +- ...NewCustomEntityMappingAnnotationsTest.java | 3 +- .../annotations/enumerated/EntityEnum.java | 1 + .../enumerated/EnumeratedTypeTest.java | 9 +- .../enumerated/FirstLetterType.java | 1 + .../enumerated/LastNumberType.java | 1 + .../secondarytable/SecondaryTableTest.java | 5 +- .../filter/subclass/SubClassTest.java | 2 +- .../filter/subclass/joined/Club.java | 1 - .../subclass/joined/JoinedSubClassTest.java | 2 +- .../GenericsInheritanceTest.java | 1 - .../id/sequences/HibernateSequenceTest.java | 1 - .../test/annotations/loader/LoaderTest.java | 46 ++---- .../test/annotations/loader/Team.java | 1 + .../test/annotations/onetomany/City.java | 2 +- .../ReferencedColumnNameTest.java | 2 +- .../BidirectionalOneToManyInverseTest.java | 5 - .../test/cache/InsertedDataTest.java | 1 - .../CascadeMergeToChildBeforeParentTest.java | 7 +- .../cfg/cache/CacheConfigurationTest.java | 3 +- .../hibernate/test/cfg/orm-serializable.xml | 1 - .../OrderCollectionOfJoinedHierarchyTest.java | 3 +- .../ordered/joinedInheritence/Zoo.java | 5 +- .../common/BasicTestingJdbcServiceImpl.java | 1 - .../test/common/JdbcConnectionAccessImpl.java | 2 +- .../test/common/TransactionContextImpl.java | 2 +- .../test/criteria/ComplexJoinAliasTest.java | 1 - .../test/criterion/CriterionTest.java | 10 +- .../test/dialect/functional/Product2.java | 2 - .../functional/SQLServerDialectTest.java | 11 +- .../org/hibernate/test/dirtiness/Thing.java | 4 +- .../StandardSchemaCatalogSupportImplTest.java | 5 +- .../test/jpa/ql/FunctionKeywordTest.java | 3 +- .../hibernate/test/jpa/ql/OnKeywordTest.java | 3 +- ...CurrentTenantResolverMultiTenancyTest.java | 1 - .../cached/CachedMutableNaturalIdTest.java | 2 +- .../hibernate/test/naturalid/nullable/A.java | 4 +- .../test/ondemandload/Inventory.java | 3 +- .../test/ondemandload/LazyLoadingTest.java | 9 +- .../hibernate/test/ondemandload/Product.java | 4 +- .../hibernate/test/ondemandload/Store.java | 6 +- .../hibernate/test/onetoone/basic/Child.java | 2 - .../onetoone/basic/OneToOneSchemaTest.java | 5 +- .../test/propertyref/DoesNotWork.java | 7 +- .../test/propertyref/DoesNotWorkPk.java | 2 +- .../test/propertyref/DoesNotWorkTest.java | 5 +- .../propertyref/DoesNotWorkWithHbmTest.java | 5 +- .../service/ClassLoaderServiceImplTest.java | 11 +- .../ExistingDatabaseMetaDataImplTest.java | 19 ++- .../sql/storedproc/StoredProcedureTest.java | 14 +- .../onetomany/nonindexed/BackrefTest.java | 5 +- .../type/AttributeConverterTest.java | 11 +- .../xml/mocker/AttributeOverride.xml | 3 +- .../annotations/xml/mocker/default-schema.xml | 3 +- .../xml/mocker/default-schema2.xml | 3 +- .../xml/mocker/entity-metadata-complete.xml | 3 +- .../annotations/xml/mocker/listener.xml | 1 - .../mocker/override-to-mappedsuperclass.xml | 1 - .../xml/mocker/persistence-metadata.xml | 1 - .../source/annotations/xml/orm-father.xml | 1 - .../source/annotations/xml/orm-invalid.xml | 1 - .../annotations/xml/orm-quote-identifier.xml | 1 - .../source/annotations/xml/orm-star.xml | 1 - .../test/annotations/access/xml/Boy.xml | 1 - .../test/annotations/access/xml/Cook.xml | 1 - .../test/annotations/access/xml/Crew.xml | 1 - .../test/annotations/access/xml/RentalCar.xml | 1 - .../test/annotations/access/xml/Tourist.xml | 1 - .../test/annotations/access/xml/Tourist2.xml | 1 - .../test/annotations/access/xml/Tourist3.xml | 1 - .../test/annotations/access/xml/Tourist4.xml | 1 - .../annotations/duplicatedgenerator/orm.xml | 1 - .../test/annotations/onetomany/orm.xml | 1 - .../test/annotations/onetoone/orm.xml | 1 - .../org/hibernate/test/annotations/orm.xml | 1 - .../hibernate/test/annotations/query/orm.xml | 1 - .../test/annotations/xml/ejb3/orm.xml | 1 - 311 files changed, 1244 insertions(+), 1379 deletions(-) create mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IndexedPluralAttributeSourceImpl.java create mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeIndexSourceImpl.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AttributeNature.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementNature.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexNature.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttributeNature.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementNature.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexNature.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeNature.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeNature.java create mode 100644 hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/OneToManyBindingTest.java diff --git a/hibernate-core/src/main/java/org/hibernate/CacheMode.java b/hibernate-core/src/main/java/org/hibernate/CacheMode.java index 43d381e88f..f8412aef88 100755 --- a/hibernate-core/src/main/java/org/hibernate/CacheMode.java +++ b/hibernate-core/src/main/java/org/hibernate/CacheMode.java @@ -23,8 +23,6 @@ */ package org.hibernate; -import org.hibernate.tool.hbm2ddl.SchemaExportTask; - /** * Controls how the session interacts with the second-level * cache and query cache. diff --git a/hibernate-core/src/main/java/org/hibernate/InvalidMappingException.java b/hibernate-core/src/main/java/org/hibernate/InvalidMappingException.java index 49a163a0d4..59a1d862a0 100644 --- a/hibernate-core/src/main/java/org/hibernate/InvalidMappingException.java +++ b/hibernate-core/src/main/java/org/hibernate/InvalidMappingException.java @@ -23,8 +23,8 @@ */ package org.hibernate; -import org.hibernate.jaxb.spi.Origin; import org.hibernate.internal.util.xml.XmlDocument; +import org.hibernate.jaxb.spi.Origin; /** * Thrown when a mapping is found to be invalid. diff --git a/hibernate-core/src/main/java/org/hibernate/StoredProcedureCall.java b/hibernate-core/src/main/java/org/hibernate/StoredProcedureCall.java index 34c4c9c7db..41fa99f58e 100644 --- a/hibernate-core/src/main/java/org/hibernate/StoredProcedureCall.java +++ b/hibernate-core/src/main/java/org/hibernate/StoredProcedureCall.java @@ -23,11 +23,10 @@ */ package org.hibernate; +import java.util.List; import javax.persistence.ParameterMode; import javax.persistence.TemporalType; -import java.util.List; -import org.hibernate.internal.StoredProcedureCallImpl; import org.hibernate.type.Type; /** diff --git a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java index ed1ae724f8..426cdbfbc1 100644 --- a/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java +++ b/hibernate-core/src/main/java/org/hibernate/action/internal/EntityDeleteAction.java @@ -29,7 +29,6 @@ import org.hibernate.AssertionFailure; import org.hibernate.HibernateException; import org.hibernate.cache.spi.CacheKey; import org.hibernate.cache.spi.access.SoftLock; -import org.hibernate.engine.spi.CachedNaturalIdValueSource; import org.hibernate.engine.spi.EntityEntry; import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.SessionImplementor; @@ -37,7 +36,6 @@ import org.hibernate.event.service.spi.EventListenerGroup; import org.hibernate.event.spi.EventType; import org.hibernate.event.spi.PostDeleteEvent; import org.hibernate.event.spi.PostDeleteEventListener; -import org.hibernate.event.spi.PostInsertEventListener; import org.hibernate.event.spi.PreDeleteEvent; import org.hibernate.event.spi.PreDeleteEventListener; import org.hibernate.persister.entity.EntityPersister; diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/SqlFragmentAlias.java b/hibernate-core/src/main/java/org/hibernate/annotations/SqlFragmentAlias.java index 031ff6417d..62d4ce9c7a 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/SqlFragmentAlias.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/SqlFragmentAlias.java @@ -23,12 +23,12 @@ */ package org.hibernate.annotations; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + import static java.lang.annotation.ElementType.FIELD; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; /** * Describe aliases for filters * diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java index 29f7a24e49..413d433504 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/NoCachingRegionFactory.java @@ -36,7 +36,6 @@ import org.hibernate.cache.spi.QueryResultsRegion; import org.hibernate.cache.spi.RegionFactory; import org.hibernate.cache.spi.TimestampsRegion; import org.hibernate.cache.spi.access.AccessType; -import org.hibernate.cfg.Settings; /** * Factory used if no caching enabled in config... diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java index 332e0129f5..98cc95f81d 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/StandardQueryCache.java @@ -26,7 +26,6 @@ package org.hibernate.cache.internal; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import java.util.Properties; import java.util.Set; import javax.persistence.EntityNotFoundException; @@ -41,7 +40,6 @@ import org.hibernate.cache.spi.QueryResultsRegion; import org.hibernate.cache.spi.RegionFactory; import org.hibernate.cache.spi.UpdateTimestampsCache; import org.hibernate.cfg.AvailableSettings; -import org.hibernate.cfg.Settings; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.internal.CoreMessageLogger; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AttributeConverterDefinition.java b/hibernate-core/src/main/java/org/hibernate/cfg/AttributeConverterDefinition.java index 371f43a546..f260dd22f9 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AttributeConverterDefinition.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AttributeConverterDefinition.java @@ -23,10 +23,10 @@ */ package org.hibernate.cfg; -import javax.persistence.AttributeConverter; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; +import javax.persistence.AttributeConverter; import org.jboss.logging.Logger; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java index aed5cff60d..01ba5d01d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/HbmBinder.java @@ -24,7 +24,6 @@ package org.hibernate.cfg; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Mappings.java b/hibernate-core/src/main/java/org/hibernate/cfg/Mappings.java index 92a9cf9136..799145014c 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Mappings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Mappings.java @@ -23,7 +23,6 @@ */ package org.hibernate.cfg; -import javax.persistence.AttributeConverter; import java.io.Serializable; import java.util.Iterator; import java.util.List; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java index 8b8a5eaafe..af877efa78 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/SettingsFactory.java @@ -38,7 +38,6 @@ import org.hibernate.cache.internal.RegionFactoryInitiator; import org.hibernate.cache.internal.StandardQueryCacheFactory; import org.hibernate.cache.spi.QueryCacheFactory; import org.hibernate.cache.spi.RegionFactory; -import org.hibernate.service.jdbc.env.spi.ExtractedDatabaseMetaData; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.transaction.spi.TransactionFactory; import org.hibernate.hql.spi.QueryTranslatorFactory; @@ -49,6 +48,7 @@ import org.hibernate.service.ServiceRegistry; import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider; +import org.hibernate.service.jdbc.env.spi.ExtractedDatabaseMetaData; import org.hibernate.service.jta.platform.spi.JtaPlatform; import org.hibernate.tuple.entity.EntityTuplizerFactory; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java index 41834a8819..50e312f940 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/CollectionBinder.java @@ -23,15 +23,11 @@ */ package org.hibernate.cfg.annotations; -import static org.hibernate.cfg.BinderHelper.toAliasEntityMap; -import static org.hibernate.cfg.BinderHelper.toAliasTableMap; - import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Properties; - import javax.persistence.AttributeOverride; import javax.persistence.AttributeOverrides; import javax.persistence.ElementCollection; @@ -45,6 +41,8 @@ import javax.persistence.MapKey; import javax.persistence.MapKeyColumn; import javax.persistence.OneToMany; +import org.jboss.logging.Logger; + import org.hibernate.AnnotationException; import org.hibernate.FetchMode; import org.hibernate.MappingException; @@ -112,7 +110,9 @@ import org.hibernate.mapping.Property; import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.Table; import org.hibernate.mapping.TypeDef; -import org.jboss.logging.Logger; + +import static org.hibernate.cfg.BinderHelper.toAliasEntityMap; +import static org.hibernate.cfg.BinderHelper.toAliasTableMap; /** * Base class for binding different types of collections to Hibernate configuration objects. diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java index b229c0042a..fa240a3ae7 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java @@ -23,14 +23,10 @@ */ package org.hibernate.cfg.annotations; -import static org.hibernate.cfg.BinderHelper.toAliasEntityMap; -import static org.hibernate.cfg.BinderHelper.toAliasTableMap; - import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; - import javax.persistence.Access; import javax.persistence.Entity; import javax.persistence.JoinColumn; @@ -39,6 +35,8 @@ import javax.persistence.PrimaryKeyJoinColumn; import javax.persistence.SecondaryTable; import javax.persistence.SecondaryTables; +import org.jboss.logging.Logger; + import org.hibernate.AnnotationException; import org.hibernate.AssertionFailure; import org.hibernate.EntityMode; @@ -98,7 +96,9 @@ import org.hibernate.mapping.SimpleValue; import org.hibernate.mapping.Table; import org.hibernate.mapping.TableOwner; import org.hibernate.mapping.Value; -import org.jboss.logging.Logger; + +import static org.hibernate.cfg.BinderHelper.toAliasEntityMap; +import static org.hibernate.cfg.BinderHelper.toAliasTableMap; /** diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java index 54f623c556..77f717c279 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/QueryBinder.java @@ -22,6 +22,7 @@ * Boston, MA 02110-1301 USA */ package org.hibernate.cfg.annotations; + import java.util.HashMap; import javax.persistence.LockModeType; import javax.persistence.NamedNativeQueries; @@ -42,7 +43,6 @@ import org.hibernate.LockMode; import org.hibernate.LockOptions; import org.hibernate.annotations.CacheModeType; import org.hibernate.annotations.FlushModeType; -import org.hibernate.annotations.QueryHints; import org.hibernate.cfg.BinderHelper; import org.hibernate.cfg.Mappings; import org.hibernate.cfg.NotYetImplementedException; diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java index 59e5d54f7c..2930f55c12 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/SimpleValueBinder.java @@ -24,9 +24,7 @@ package org.hibernate.cfg.annotations; import java.io.Serializable; -import java.lang.annotation.Annotation; import java.lang.reflect.TypeVariable; -import java.sql.Types; import java.util.Calendar; import java.util.Date; import java.util.Properties; @@ -41,6 +39,8 @@ import javax.persistence.MapKeyTemporal; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import org.jboss.logging.Logger; + import org.hibernate.AnnotationException; import org.hibernate.AssertionFailure; import org.hibernate.MappingException; @@ -70,8 +70,6 @@ import org.hibernate.type.StandardBasicTypes; import org.hibernate.type.WrappedMaterializedBlobType; import org.hibernate.usertype.DynamicParameterizedType; -import org.jboss.logging.Logger; - /** * @author Emmanuel Bernard */ diff --git a/hibernate-core/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java b/hibernate-core/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java index 80db62ed21..2038ef3d2e 100644 --- a/hibernate-core/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java +++ b/hibernate-core/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java @@ -23,7 +23,6 @@ */ package org.hibernate.collection.internal; -import javax.naming.NamingException; import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; @@ -32,6 +31,7 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.ListIterator; +import javax.naming.NamingException; import org.jboss.logging.Logger; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index d17d3035c9..4b579f0ec9 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -39,7 +39,6 @@ import java.util.Map; import java.util.Properties; import java.util.Set; -import org.hibernate.engine.spi.RowSelection; import org.jboss.logging.Logger; import org.hibernate.HibernateException; @@ -62,6 +61,7 @@ import org.hibernate.dialect.lock.SelectLockingStrategy; import org.hibernate.dialect.pagination.LegacyLimitHandler; import org.hibernate.dialect.pagination.LimitHandler; import org.hibernate.engine.jdbc.LobCreator; +import org.hibernate.engine.spi.RowSelection; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.exception.spi.ConversionContext; import org.hibernate.exception.spi.SQLExceptionConversionDelegate; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java index e4bc9bdfc8..71fd333163 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/H2Dialect.java @@ -23,6 +23,11 @@ */ package org.hibernate.dialect; +import java.sql.SQLException; +import java.sql.Types; + +import org.jboss.logging.Logger; + import org.hibernate.JDBCException; import org.hibernate.PessimisticLockException; import org.hibernate.cfg.AvailableSettings; @@ -38,10 +43,6 @@ import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.JdbcExceptionHelper; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.type.StandardBasicTypes; -import org.jboss.logging.Logger; - -import java.sql.SQLException; -import java.sql.Types; /** * A dialect compatible with the H2 database. diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASE157Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASE157Dialect.java index dc9a08b50e..565b68377c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASE157Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SybaseASE157Dialect.java @@ -27,15 +27,10 @@ import java.sql.SQLException; import java.util.Map; import org.hibernate.JDBCException; -import org.hibernate.LockMode; import org.hibernate.LockOptions; -import org.hibernate.QueryTimeoutException; import org.hibernate.dialect.function.SQLFunctionTemplate; -import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.LockTimeoutException; import org.hibernate.exception.spi.SQLExceptionConversionDelegate; -import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter; -import org.hibernate.exception.spi.ViolatedConstraintNameExtracter; import org.hibernate.internal.util.JdbcExceptionHelper; import org.hibernate.sql.ForUpdateFragment; import org.hibernate.type.StandardBasicTypes; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java index ea0b0dbf4b..9c5141f137 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/LimitHandler.java @@ -3,8 +3,6 @@ package org.hibernate.dialect.pagination; import java.sql.PreparedStatement; import java.sql.SQLException; -import org.hibernate.engine.spi.RowSelection; - /** * Contract defining dialect-specific LIMIT clause handling. Typically implementers might consider extending * {@link AbstractLimitHandler} class. diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java index eb5f8a8bfd..ba4bb21c66 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/Cascade.java @@ -41,7 +41,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.Status; import org.hibernate.event.spi.EventSource; import org.hibernate.internal.CoreMessageLogger; -import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.pretty.MessageHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java index 3e4007ea6a..6b7185df56 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/StatefulPersistenceContext.java @@ -76,7 +76,6 @@ import org.hibernate.persister.entity.EntityPersister; import org.hibernate.pretty.MessageHelper; import org.hibernate.proxy.HibernateProxy; import org.hibernate.proxy.LazyInitializer; -import org.hibernate.sql.Select; import org.hibernate.tuple.ElementWrapper; import org.hibernate.type.CollectionType; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/LogicalConnectionImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/LogicalConnectionImpl.java index c0364397ff..791d2f40ba 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/LogicalConnectionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/LogicalConnectionImpl.java @@ -39,7 +39,6 @@ import org.hibernate.HibernateException; import org.hibernate.JDBCException; import org.hibernate.engine.jdbc.internal.proxy.ProxyBuilder; import org.hibernate.engine.jdbc.spi.ConnectionObserver; -import org.hibernate.service.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.engine.jdbc.spi.JdbcResourceRegistry; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor; @@ -47,6 +46,7 @@ import org.hibernate.engine.jdbc.spi.NonDurableConnectionObserver; import org.hibernate.engine.transaction.spi.TransactionContext; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.service.jdbc.connections.spi.JdbcConnectionAccess; /** * Standard Hibernate {@link org.hibernate.engine.jdbc.spi.LogicalConnection} implementation diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java index fc51fea5fd..c186ed1482 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcServices.java @@ -28,10 +28,10 @@ import java.sql.ResultSet; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.LobCreationContext; import org.hibernate.engine.jdbc.LobCreator; -import org.hibernate.service.jdbc.env.spi.ExtractedDatabaseMetaData; -import org.hibernate.service.jdbc.env.spi.JdbcEnvironment; import org.hibernate.service.Service; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; +import org.hibernate.service.jdbc.env.spi.ExtractedDatabaseMetaData; +import org.hibernate.service.jdbc.env.spi.JdbcEnvironment; /** * Contract for services around JDBC operations. These represent shared resources, aka not varied by session/use. diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/CacheInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/CacheInitiator.java index 6217af2a3b..d972b652e2 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/CacheInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/CacheInitiator.java @@ -24,10 +24,10 @@ package org.hibernate.engine.spi; import org.hibernate.cfg.Configuration; +import org.hibernate.internal.CacheImpl; import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.SessionFactoryServiceInitiator; -import org.hibernate.internal.CacheImpl; /** * @author Strong Liu diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java index eb3e242f62..bb3c3e46f7 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java @@ -23,10 +23,10 @@ */ package org.hibernate.engine.spi; -import javax.persistence.metamodel.Metamodel; import java.util.Map; import java.util.Properties; import java.util.Set; +import javax.persistence.metamodel.Metamodel; import org.hibernate.CustomEntityDirtinessStrategy; import org.hibernate.HibernateException; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java index af8490fb77..594bef3e11 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java @@ -39,12 +39,12 @@ import org.hibernate.ScrollableResults; import org.hibernate.cache.spi.CacheKey; import org.hibernate.collection.spi.PersistentCollection; import org.hibernate.engine.jdbc.LobCreationContext; -import org.hibernate.service.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.engine.query.spi.sql.NativeSQLQuerySpecification; import org.hibernate.engine.transaction.spi.TransactionCoordinator; import org.hibernate.internal.CriteriaImpl; import org.hibernate.loader.custom.CustomQuery; import org.hibernate.persister.entity.EntityPersister; +import org.hibernate.service.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.type.Type; /** diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SyntheticAttributeHelper.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SyntheticAttributeHelper.java index 143f552823..edad7ee2d7 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SyntheticAttributeHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SyntheticAttributeHelper.java @@ -23,8 +23,6 @@ */ package org.hibernate.engine.spi; -import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; - /** * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java index 2748d29104..3d9b7c814e 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/jta/JtaIsolationDelegate.java @@ -23,12 +23,12 @@ */ package org.hibernate.engine.transaction.internal.jta; +import java.sql.Connection; +import java.sql.SQLException; import javax.transaction.NotSupportedException; import javax.transaction.SystemException; import javax.transaction.Transaction; import javax.transaction.TransactionManager; -import java.sql.Connection; -import java.sql.SQLException; import org.jboss.logging.Logger; diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultResolveNaturalIdEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultResolveNaturalIdEventListener.java index 5c59ea3977..e650632970 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultResolveNaturalIdEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultResolveNaturalIdEventListener.java @@ -29,7 +29,6 @@ import org.jboss.logging.Logger; import org.hibernate.HibernateException; import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy; -import org.hibernate.engine.spi.CachedNaturalIdValueSource; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.event.spi.ResolveNaturalIdEvent; import org.hibernate.event.spi.ResolveNaturalIdEventListener; diff --git a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/AbstractMapComponentNode.java b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/AbstractMapComponentNode.java index a382f5c7d7..f664920f4c 100644 --- a/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/AbstractMapComponentNode.java +++ b/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/AbstractMapComponentNode.java @@ -28,7 +28,6 @@ import java.util.Map; import antlr.SemanticException; import antlr.collections.AST; -import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes; import org.hibernate.hql.internal.ast.util.ColumnHelper; import org.hibernate.internal.util.StringHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java index a1d080be08..30919ca92d 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java @@ -37,7 +37,6 @@ import org.hibernate.cfg.ObjectNameNormalizer; import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.mapping.Table; import org.hibernate.metamodel.spi.relational.Database; import org.hibernate.metamodel.spi.relational.ObjectName; import org.hibernate.metamodel.spi.relational.Schema; diff --git a/hibernate-core/src/main/java/org/hibernate/id/SequenceIdentityGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/SequenceIdentityGenerator.java index 49d36f5d58..a2180c58f8 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/SequenceIdentityGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/SequenceIdentityGenerator.java @@ -26,12 +26,10 @@ package org.hibernate.id; import java.io.Serializable; import java.sql.PreparedStatement; import java.sql.SQLException; -import java.util.Properties; import org.jboss.logging.Logger; import org.hibernate.HibernateException; -import org.hibernate.MappingException; import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.id.insert.AbstractReturningDelegate; @@ -39,7 +37,6 @@ import org.hibernate.id.insert.IdentifierGeneratingInsert; import org.hibernate.id.insert.InsertGeneratedIdentifierDelegate; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.sql.Insert; -import org.hibernate.type.Type; /** * A generator which combines sequence generation with immediate retrieval diff --git a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java index 18090b17ba..e09155ee62 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/TableGenerator.java @@ -44,7 +44,6 @@ import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.jdbc.AbstractReturningWork; -import org.hibernate.mapping.Table; import org.hibernate.metamodel.spi.relational.Database; import org.hibernate.metamodel.spi.relational.ObjectName; import org.hibernate.type.Type; diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStyleGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStyleGenerator.java index bf4a23b64c..4bf02edd6a 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStyleGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/SequenceStyleGenerator.java @@ -42,8 +42,6 @@ import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.metamodel.spi.relational.Database; import org.hibernate.metamodel.spi.relational.Identifier; import org.hibernate.metamodel.spi.relational.ObjectName; -import org.hibernate.metamodel.spi.relational.Schema; -import org.hibernate.metamodel.spi.relational.Sequence; import org.hibernate.type.Type; /** diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java index 63c1582f3c..707bbf66a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/TableGenerator.java @@ -54,7 +54,6 @@ import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.config.ConfigurationHelper; import org.hibernate.jdbc.AbstractReturningWork; -import org.hibernate.mapping.Table; import org.hibernate.metamodel.spi.relational.Column; import org.hibernate.metamodel.spi.relational.Database; import org.hibernate.metamodel.spi.relational.Identifier; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractBasicQueryContractImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractBasicQueryContractImpl.java index f6d32d155f..09c130d2df 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractBasicQueryContractImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractBasicQueryContractImpl.java @@ -23,9 +23,6 @@ */ package org.hibernate.internal; -import java.io.Serializable; -import java.util.Map; - import org.hibernate.BasicQueryContract; import org.hibernate.CacheMode; import org.hibernate.FlushMode; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java index 8eecfd4a94..72c702266b 100755 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSessionImpl.java @@ -39,7 +39,6 @@ import org.hibernate.SharedSessionContract; import org.hibernate.StoredProcedureCall; import org.hibernate.cache.spi.CacheKey; import org.hibernate.engine.jdbc.LobCreationContext; -import org.hibernate.service.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.engine.query.spi.HQLQueryPlan; import org.hibernate.engine.query.spi.NativeSQLQueryPlan; import org.hibernate.engine.query.spi.ParameterMetadata; @@ -56,6 +55,7 @@ import org.hibernate.jdbc.WorkExecutor; import org.hibernate.jdbc.WorkExecutorVisitable; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; +import org.hibernate.service.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider; import org.hibernate.type.Type; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java b/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java index ceb43ff878..53a7e4aa40 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/FilterConfiguration.java @@ -43,7 +43,6 @@ public class FilterConfiguration { private final Map aliasTableMap; private final Map aliasEntityMap; private final PersistentClass persistentClass; - public FilterConfiguration( String name, String condition, diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 6b6a176a1c..0cc6dad35c 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -23,9 +23,6 @@ */ package org.hibernate.internal; -import javax.naming.Reference; -import javax.naming.StringRefAddr; -import javax.persistence.metamodel.Metamodel; import java.io.IOException; import java.io.InvalidObjectException; import java.io.ObjectInputStream; @@ -41,6 +38,9 @@ import java.util.Map; import java.util.Properties; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; +import javax.naming.Reference; +import javax.naming.StringRefAddr; +import javax.persistence.metamodel.Metamodel; import org.jboss.logging.Logger; @@ -112,8 +112,6 @@ import org.hibernate.id.UUIDGenerator; import org.hibernate.id.factory.IdentifierGeneratorFactory; import org.hibernate.integrator.spi.Integrator; import org.hibernate.integrator.spi.IntegratorService; -import org.hibernate.metamodel.spi.MetadataImplementor; -import org.hibernate.service.classloading.spi.StrategyInstanceResolver; import org.hibernate.jpa.metamodel.internal.JpaMetaModelPopulationSetting; import org.hibernate.jpa.metamodel.internal.builder.MetamodelBuilder; import org.hibernate.mapping.Collection; @@ -121,6 +119,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.spi.MetadataImplementor; import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; import org.hibernate.persister.collection.CollectionPersister; @@ -132,6 +131,7 @@ import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.classloading.spi.ClassLoadingException; +import org.hibernate.service.classloading.spi.StrategyInstanceResolver; import org.hibernate.service.config.spi.ConfigurationService; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jndi.spi.JndiService; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index 52824ed5e0..4abe5f460a 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -73,10 +73,9 @@ import org.hibernate.ScrollableResults; import org.hibernate.Session; import org.hibernate.SessionBuilder; import org.hibernate.SessionException; -import org.hibernate.StoredProcedureCall; -import org.hibernate.engine.spi.SessionOwner; import org.hibernate.SharedSessionBuilder; import org.hibernate.SimpleNaturalIdLoadAccess; +import org.hibernate.StoredProcedureCall; import org.hibernate.Transaction; import org.hibernate.TransientObjectException; import org.hibernate.TypeHelper; @@ -99,6 +98,7 @@ import org.hibernate.engine.spi.NonFlushedChanges; import org.hibernate.engine.spi.PersistenceContext; import org.hibernate.engine.spi.QueryParameters; import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionOwner; import org.hibernate.engine.spi.Status; import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.spi.TransactionCoordinator; @@ -138,7 +138,6 @@ import org.hibernate.event.spi.ResolveNaturalIdEventListener; import org.hibernate.event.spi.SaveOrUpdateEvent; import org.hibernate.event.spi.SaveOrUpdateEventListener; import org.hibernate.internal.CriteriaImpl.CriterionEntry; -import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.jdbc.ReturningWork; import org.hibernate.jdbc.Work; import org.hibernate.jdbc.WorkExecutor; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureCallImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureCallImpl.java index 61ee607590..28604fa1f3 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureCallImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureCallImpl.java @@ -23,8 +23,6 @@ */ package org.hibernate.internal; -import javax.persistence.ParameterMode; -import javax.persistence.TemporalType; import java.sql.CallableStatement; import java.sql.SQLException; import java.util.ArrayList; @@ -36,6 +34,8 @@ import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; +import javax.persistence.ParameterMode; +import javax.persistence.TemporalType; import org.jboss.logging.Logger; @@ -47,7 +47,6 @@ import org.hibernate.StoredProcedureCall; import org.hibernate.StoredProcedureOutputs; import org.hibernate.cfg.NotYetImplementedException; import org.hibernate.engine.ResultSetMappingDefinition; -import org.hibernate.service.jdbc.env.spi.ExtractedDatabaseMetaData; import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn; import org.hibernate.engine.query.spi.sql.NativeSQLQueryRootReturn; import org.hibernate.engine.spi.QueryParameters; @@ -55,6 +54,7 @@ import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.internal.util.StringHelper; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.service.jdbc.cursor.spi.RefCursorSupport; +import org.hibernate.service.jdbc.env.spi.ExtractedDatabaseMetaData; import org.hibernate.type.DateType; import org.hibernate.type.ProcedureParameterExtractionAware; import org.hibernate.type.Type; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureOutputsImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureOutputsImpl.java index 590b8b8c75..2912108abf 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureOutputsImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/StoredProcedureOutputsImpl.java @@ -23,17 +23,14 @@ */ package org.hibernate.internal; -import javax.persistence.ParameterMode; import java.sql.CallableStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.hibernate.JDBCException; -import org.hibernate.StoredProcedureCall.StoredProcedureParameter; import org.hibernate.StoredProcedureOutputs; import org.hibernate.StoredProcedureResultSetReturn; import org.hibernate.StoredProcedureReturn; diff --git a/hibernate-core/src/main/java/org/hibernate/jaxb/internal/JaxbConfigurationProcessor.java b/hibernate-core/src/main/java/org/hibernate/jaxb/internal/JaxbConfigurationProcessor.java index 3691ed15b6..8add8ef5a0 100644 --- a/hibernate-core/src/main/java/org/hibernate/jaxb/internal/JaxbConfigurationProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/jaxb/internal/JaxbConfigurationProcessor.java @@ -52,9 +52,9 @@ import javax.xml.validation.SchemaFactory; import org.jboss.logging.Logger; import org.xml.sax.SAXException; +import org.hibernate.internal.util.config.ConfigurationException; import org.hibernate.jaxb.spi.Origin; import org.hibernate.jaxb.spi.cfg.JaxbHibernateConfiguration; -import org.hibernate.internal.util.config.ConfigurationException; import org.hibernate.metamodel.spi.source.MappingException; import org.hibernate.metamodel.spi.source.XsdException; import org.hibernate.service.classloading.spi.ClassLoaderService; diff --git a/hibernate-core/src/main/java/org/hibernate/jaxb/internal/NamespaceAddingEventReader.java b/hibernate-core/src/main/java/org/hibernate/jaxb/internal/NamespaceAddingEventReader.java index 97833ebf76..3407379c98 100644 --- a/hibernate-core/src/main/java/org/hibernate/jaxb/internal/NamespaceAddingEventReader.java +++ b/hibernate-core/src/main/java/org/hibernate/jaxb/internal/NamespaceAddingEventReader.java @@ -23,6 +23,9 @@ */ package org.hibernate.jaxb.internal; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import javax.xml.namespace.QName; import javax.xml.stream.XMLEventFactory; import javax.xml.stream.XMLEventReader; @@ -31,9 +34,6 @@ import javax.xml.stream.events.Namespace; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; import javax.xml.stream.util.EventReaderDelegate; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; /** * Used to wrap a StAX {@link XMLEventReader} in order to introduce namespaces into the underlying document. This diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/MetamodelImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/MetamodelImpl.java index 5bde4e525e..da0e2c7957 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/MetamodelImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/MetamodelImpl.java @@ -23,14 +23,14 @@ */ package org.hibernate.jpa.metamodel.internal; -import javax.persistence.metamodel.EmbeddableType; -import javax.persistence.metamodel.EntityType; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.Metamodel; import java.io.Serializable; import java.util.HashSet; import java.util.Map; import java.util.Set; +import javax.persistence.metamodel.EmbeddableType; +import javax.persistence.metamodel.EntityType; +import javax.persistence.metamodel.ManagedType; +import javax.persistence.metamodel.Metamodel; import org.hibernate.internal.util.collections.CollectionHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java index e57a618c25..31293b3722 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java @@ -23,19 +23,18 @@ */ package org.hibernate.jpa.metamodel.internal.builder; +import java.lang.reflect.Field; +import java.lang.reflect.Member; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; import javax.persistence.OneToOne; import javax.persistence.metamodel.Attribute; import javax.persistence.metamodel.IdentifiableType; import javax.persistence.metamodel.PluralAttribute; import javax.persistence.metamodel.Type; -import java.lang.reflect.Field; -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.lang.reflect.ParameterizedType; import org.jboss.logging.Logger; -import org.hibernate.HibernateException; import org.hibernate.annotations.common.AssertionFailure; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.jpa.metamodel.internal.AbstractIdentifiableType; @@ -51,10 +50,8 @@ import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding; import org.hibernate.metamodel.spi.binding.IndexedPluralAttributeBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeElementNature; -import org.hibernate.metamodel.spi.binding.PluralAttributeIndexNature; +import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; -import org.hibernate.metamodel.spi.domain.PluralAttributeNature; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.tuple.entity.EntityMetamodel; import org.hibernate.type.ComponentType; @@ -320,53 +317,53 @@ public class AttributeBuilder { else { final PluralAttributeBinding pluralAttributeBinding = (PluralAttributeBinding) attributeBinding; - if ( pluralAttributeBinding.getAttribute().getNature() == PluralAttributeNature.ARRAY ) { + if ( pluralAttributeBinding.getAttribute().getNature() == org.hibernate.metamodel.spi.domain.PluralAttribute.Nature.ARRAY ) { context.handleUnsupportedFeature( UnsupportedFeature.ARRAY ); } // First, determine the type of the elements and use that to help determine the // collection type) final PluralAttributeElementBinding elementBinding = pluralAttributeBinding.getPluralAttributeElementBinding(); - final PluralAttributeElementNature elementNature = elementBinding.getPluralAttributeElementNature(); + final PluralAttributeElementBinding.Nature elementNature = elementBinding.getNature(); final PersistentAttributeType persistentAttributeType; final PersistentAttributeType elementPersistentAttributeType; PersistentAttributeType keyPersistentAttributeType = null; - if ( elementNature == PluralAttributeElementNature.MANY_TO_ANY ) { + if ( elementNature == PluralAttributeElementBinding.Nature.MANY_TO_ANY ) { // ANY mappings are currently not supported in the JPA metamodel; see HHH-6589 context.handleUnsupportedFeature( UnsupportedFeature.ANY ); return null; } - else if ( elementNature == PluralAttributeElementNature.BASIC ) { + else if ( elementNature == PluralAttributeElementBinding.Nature.BASIC ) { elementPersistentAttributeType = PersistentAttributeType.BASIC; persistentAttributeType = PersistentAttributeType.ELEMENT_COLLECTION; } - else if ( elementNature == PluralAttributeElementNature.COMPOSITE ) { + else if ( elementNature == PluralAttributeElementBinding.Nature.COMPOSITE ) { elementPersistentAttributeType = PersistentAttributeType.EMBEDDED; persistentAttributeType = PersistentAttributeType.ELEMENT_COLLECTION; } else { - elementPersistentAttributeType = elementNature == PluralAttributeElementNature.MANY_TO_MANY + elementPersistentAttributeType = elementNature == PluralAttributeElementBinding.Nature.MANY_TO_MANY ? PersistentAttributeType.MANY_TO_MANY : PersistentAttributeType.ONE_TO_MANY; persistentAttributeType = elementPersistentAttributeType; } // For maps, also check the key binding - if ( pluralAttributeBinding.getAttribute().getNature() == PluralAttributeNature.MAP ) { + if ( pluralAttributeBinding.getAttribute().getNature() == org.hibernate.metamodel.spi.domain.PluralAttribute.Nature.MAP ) { final IndexedPluralAttributeBinding indexedPluralAttributeBinding = (IndexedPluralAttributeBinding) pluralAttributeBinding; - final PluralAttributeIndexNature indexNature + final PluralAttributeIndexBinding.Nature indexNature = indexedPluralAttributeBinding.getPluralAttributeIndexBinding().getPluralAttributeIndexNature(); - if ( indexNature == PluralAttributeIndexNature.MANY_TO_ANY ) { + if ( indexNature == PluralAttributeIndexBinding.Nature.MANY_TO_ANY ) { context.handleUnsupportedFeature( UnsupportedFeature.ANY ); return null; } - else if ( indexNature == PluralAttributeIndexNature.MANY_TO_MANY ) { + else if ( indexNature == PluralAttributeIndexBinding.Nature.MANY_TO_MANY ) { keyPersistentAttributeType = Attribute.PersistentAttributeType.MANY_TO_ONE; } - else if ( indexNature == PluralAttributeIndexNature.COMPOSITE ) { + else if ( indexNature == PluralAttributeIndexBinding.Nature.COMPOSITE ) { keyPersistentAttributeType = Attribute.PersistentAttributeType.EMBEDDED; } else { diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeMetadata.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeMetadata.java index 5924dd84e0..5731149729 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeMetadata.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeMetadata.java @@ -23,8 +23,8 @@ */ package org.hibernate.jpa.metamodel.internal.builder; -import javax.persistence.metamodel.Attribute; import java.lang.reflect.Member; +import javax.persistence.metamodel.Attribute; import org.hibernate.jpa.metamodel.internal.AbstractManagedType; import org.hibernate.metamodel.spi.binding.AttributeBinding; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/BaseAttributeMetadata.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/BaseAttributeMetadata.java index 28a0467522..02b1379371 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/BaseAttributeMetadata.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/BaseAttributeMetadata.java @@ -23,10 +23,10 @@ */ package org.hibernate.jpa.metamodel.internal.builder; -import javax.persistence.metamodel.Attribute; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; +import javax.persistence.metamodel.Attribute; import org.hibernate.jpa.metamodel.internal.AbstractManagedType; import org.hibernate.metamodel.spi.binding.AttributeBinding; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/MetamodelBuilder.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/MetamodelBuilder.java index b2424f89e5..de4a0e030e 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/MetamodelBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/MetamodelBuilder.java @@ -23,21 +23,19 @@ */ package org.hibernate.jpa.metamodel.internal.builder; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import javax.persistence.metamodel.Attribute; +import javax.persistence.metamodel.SingularAttribute; +import javax.persistence.metamodel.Type; import org.jboss.logging.Logger; import org.hibernate.HibernateException; -import org.hibernate.cfg.NotYetImplementedException; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.jpa.metamodel.internal.AbstractIdentifiableType; import org.hibernate.jpa.metamodel.internal.EmbeddableTypeImpl; @@ -46,9 +44,6 @@ import org.hibernate.jpa.metamodel.internal.JpaMetaModelPopulationSetting; import org.hibernate.jpa.metamodel.internal.MappedSuperclassTypeImpl; import org.hibernate.jpa.metamodel.internal.MetamodelImpl; import org.hibernate.jpa.metamodel.internal.UnsupportedFeature; -import org.hibernate.mapping.Component; -import org.hibernate.mapping.KeyValue; -import org.hibernate.mapping.Property; import org.hibernate.metamodel.spi.binding.AttributeBinding; import org.hibernate.metamodel.spi.binding.BasicAttributeBinding; import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java index eea0730eb5..59a10d2555 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java @@ -23,11 +23,11 @@ */ package org.hibernate.jpa.metamodel.internal.builder; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.PluralAttribute; import java.lang.reflect.Member; import java.lang.reflect.ParameterizedType; import java.lang.reflect.TypeVariable; +import javax.persistence.metamodel.Attribute; +import javax.persistence.metamodel.PluralAttribute; import org.hibernate.annotations.common.AssertionFailure; import org.hibernate.jpa.metamodel.internal.AbstractManagedType; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java index 7e152eecb3..177d3ce588 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java @@ -23,8 +23,8 @@ */ package org.hibernate.jpa.metamodel.internal.builder; -import javax.persistence.metamodel.Attribute; import java.lang.reflect.Member; +import javax.persistence.metamodel.Attribute; import org.hibernate.jpa.metamodel.internal.AbstractManagedType; import org.hibernate.metamodel.spi.binding.AttributeBinding; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractAttribute.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractAttribute.java index 3b10a00fbe..26212edb0e 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractAttribute.java @@ -23,14 +23,14 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.ManagedType; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.lang.reflect.Member; import java.lang.reflect.Method; +import javax.persistence.metamodel.Attribute; +import javax.persistence.metamodel.ManagedType; import org.hibernate.internal.util.ReflectHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractIdentifiableType.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractIdentifiableType.java index 2377665136..a654b1df17 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractIdentifiableType.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractIdentifiableType.java @@ -23,13 +23,13 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; +import java.io.Serializable; +import java.util.HashSet; +import java.util.Set; import javax.persistence.metamodel.Attribute; import javax.persistence.metamodel.IdentifiableType; import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.Type; -import java.io.Serializable; -import java.util.HashSet; -import java.util.Set; /** * Defines commonality for the JPA {@link javax.persistence.metamodel.IdentifiableType} types. JPA defines diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractManagedType.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractManagedType.java index 04043de697..c91c6d4ac9 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractManagedType.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractManagedType.java @@ -23,6 +23,11 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; +import java.io.Serializable; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; import javax.persistence.metamodel.Attribute; import javax.persistence.metamodel.Bindable; import javax.persistence.metamodel.CollectionAttribute; @@ -32,11 +37,6 @@ import javax.persistence.metamodel.MapAttribute; import javax.persistence.metamodel.PluralAttribute; import javax.persistence.metamodel.SetAttribute; import javax.persistence.metamodel.SingularAttribute; -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; import org.hibernate.annotations.common.AssertionFailure; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractType.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractType.java index 726dd8e57a..a95ff46481 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractType.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AbstractType.java @@ -23,8 +23,8 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.Type; import java.io.Serializable; +import javax.persistence.metamodel.Type; /** * Defines commonality for the JPA {@link javax.persistence.metamodel.Type} hierarchy of interfaces. diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AttributeFactory.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AttributeFactory.java index 10376d1ced..da72385208 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AttributeFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/AttributeFactory.java @@ -23,18 +23,18 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.ManyToMany; -import javax.persistence.OneToOne; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.Type; import java.lang.reflect.Field; import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.TypeVariable; import java.util.Iterator; +import javax.persistence.ManyToMany; +import javax.persistence.OneToOne; +import javax.persistence.metamodel.Attribute; +import javax.persistence.metamodel.IdentifiableType; +import javax.persistence.metamodel.PluralAttribute; +import javax.persistence.metamodel.Type; import org.jboss.logging.Logger; @@ -51,7 +51,6 @@ import org.hibernate.mapping.Property; import org.hibernate.mapping.Value; import org.hibernate.tuple.entity.EntityMetamodel; import org.hibernate.type.ComponentType; -import org.hibernate.type.EmbeddedComponentType; import org.hibernate.type.EntityType; /** diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/BasicTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/BasicTypeImpl.java index ae2f7cc0f8..2b0db87b96 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/BasicTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/BasicTypeImpl.java @@ -21,8 +21,8 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.BasicType; import java.io.Serializable; +import javax.persistence.metamodel.BasicType; /** * @author Emmanuel Bernard diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EmbeddableTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EmbeddableTypeImpl.java index f62ead89b5..19a9f2e4a0 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EmbeddableTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EmbeddableTypeImpl.java @@ -21,8 +21,8 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.EmbeddableType; import java.io.Serializable; +import javax.persistence.metamodel.EmbeddableType; import org.hibernate.type.ComponentType; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EntityTypeImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EntityTypeImpl.java index 72b7bcb1c7..bde13319d9 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EntityTypeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/EntityTypeImpl.java @@ -21,8 +21,8 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.EntityType; import java.io.Serializable; +import javax.persistence.metamodel.EntityType; /** * Defines the Hibernate implementation of the JPA {@link javax.persistence.metamodel.EntityType} contract. diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetadataContext.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetadataContext.java index 32fbae8305..3ee0687a66 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetadataContext.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetadataContext.java @@ -23,10 +23,6 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.Attribute; -import javax.persistence.metamodel.IdentifiableType; -import javax.persistence.metamodel.MappedSuperclassType; -import javax.persistence.metamodel.SingularAttribute; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; @@ -36,6 +32,10 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import javax.persistence.metamodel.Attribute; +import javax.persistence.metamodel.IdentifiableType; +import javax.persistence.metamodel.MappedSuperclassType; +import javax.persistence.metamodel.SingularAttribute; import org.jboss.logging.Logger; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetamodelImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetamodelImpl.java index 6fdee63fdf..46350b2be8 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetamodelImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/MetamodelImpl.java @@ -23,16 +23,16 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.EmbeddableType; -import javax.persistence.metamodel.EntityType; -import javax.persistence.metamodel.ManagedType; -import javax.persistence.metamodel.MappedSuperclassType; -import javax.persistence.metamodel.Metamodel; import java.io.Serializable; import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; +import javax.persistence.metamodel.EmbeddableType; +import javax.persistence.metamodel.EntityType; +import javax.persistence.metamodel.ManagedType; +import javax.persistence.metamodel.MappedSuperclassType; +import javax.persistence.metamodel.Metamodel; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.internal.util.collections.CollectionHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/PluralAttributeImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/PluralAttributeImpl.java index 688317b450..2df68203da 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/PluralAttributeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/PluralAttributeImpl.java @@ -21,18 +21,18 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.CollectionAttribute; -import javax.persistence.metamodel.ListAttribute; -import javax.persistence.metamodel.MapAttribute; -import javax.persistence.metamodel.PluralAttribute; -import javax.persistence.metamodel.SetAttribute; -import javax.persistence.metamodel.Type; import java.io.Serializable; import java.lang.reflect.Member; import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Set; +import javax.persistence.metamodel.CollectionAttribute; +import javax.persistence.metamodel.ListAttribute; +import javax.persistence.metamodel.MapAttribute; +import javax.persistence.metamodel.PluralAttribute; +import javax.persistence.metamodel.SetAttribute; +import javax.persistence.metamodel.Type; import org.hibernate.mapping.Property; diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/SingularAttributeImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/SingularAttributeImpl.java index 229d9214b9..7b9f355fd2 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/SingularAttributeImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/legacy/SingularAttributeImpl.java @@ -21,10 +21,10 @@ */ package org.hibernate.jpa.metamodel.internal.legacy; -import javax.persistence.metamodel.SingularAttribute; -import javax.persistence.metamodel.Type; import java.io.Serializable; import java.lang.reflect.Member; +import javax.persistence.metamodel.SingularAttribute; +import javax.persistence.metamodel.Type; /** * @author Emmanuel Bernard diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java index c6cde9d0af..99f3b003dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java @@ -25,7 +25,6 @@ package org.hibernate.mapping; import java.lang.annotation.Annotation; import java.lang.reflect.Field; -import javax.persistence.AttributeConverter; import java.lang.reflect.TypeVariable; import java.sql.CallableStatement; import java.sql.PreparedStatement; @@ -35,6 +34,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Properties; +import javax.persistence.AttributeConverter; import org.jboss.logging.Logger; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/MetadataSources.java b/hibernate-core/src/main/java/org/hibernate/metamodel/MetadataSources.java index 6bfedaa925..0de1a5745f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/MetadataSources.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/MetadataSources.java @@ -38,10 +38,9 @@ import java.util.Set; import java.util.jar.JarFile; import java.util.zip.ZipEntry; -import org.jboss.logging.Logger; - import org.jboss.jandex.IndexView; import org.jboss.jandex.Indexer; +import org.jboss.logging.Logger; import org.w3c.dom.Document; import org.hibernate.HibernateException; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java index 820469b89b..06cf52cbff 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/Binder.java @@ -76,9 +76,8 @@ import org.hibernate.metamodel.spi.binding.MapBinding; import org.hibernate.metamodel.spi.binding.MetaAttribute; import org.hibernate.metamodel.spi.binding.OneToManyPluralAttributeElementBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeElementNature; +import org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeIndexNature; import org.hibernate.metamodel.spi.binding.PluralAttributeKeyBinding; import org.hibernate.metamodel.spi.binding.RelationalValueBinding; import org.hibernate.metamodel.spi.binding.SecondaryTable; @@ -127,16 +126,15 @@ import org.hibernate.metamodel.spi.source.MultiTenancySource; import org.hibernate.metamodel.spi.source.NonAggregatedCompositeIdentifierSource; import org.hibernate.metamodel.spi.source.OneToManyPluralAttributeElementSource; import org.hibernate.metamodel.spi.source.Orderable; +import org.hibernate.metamodel.spi.source.PluralAttributeElementSource; import org.hibernate.metamodel.spi.source.PluralAttributeIndexSource; import org.hibernate.metamodel.spi.source.PluralAttributeKeySource; -import org.hibernate.metamodel.spi.source.PluralAttributeNature; import org.hibernate.metamodel.spi.source.PluralAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; import org.hibernate.metamodel.spi.source.RelationalValueSourceContainer; import org.hibernate.metamodel.spi.source.RootEntitySource; import org.hibernate.metamodel.spi.source.SecondaryTableSource; import org.hibernate.metamodel.spi.source.SimpleIdentifierSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.SingularAttributeSource; import org.hibernate.metamodel.spi.source.Sortable; import org.hibernate.metamodel.spi.source.SubclassEntitySource; @@ -401,7 +399,7 @@ public class Binder { private void bindBasicCollectionKey( final AbstractPluralAttributeBinding attributeBinding, final PluralAttributeSource attributeSource) { - if ( attributeSource.getElementSource().getNature() != org.hibernate.metamodel.spi.source.PluralAttributeElementNature.BASIC ) { + if ( attributeSource.getElementSource().getNature() != PluralAttributeElementSource.Nature.BASIC ) { throw new AssertionFailure( String.format( "Expected basic attribute binding; instead got {%s}", @@ -437,10 +435,10 @@ public class Binder { private void bindBasicSetElementTablePrimaryKey(final PluralAttributeBinding attributeBinding) { final BasicPluralAttributeElementBinding elementBinding = ( BasicPluralAttributeElementBinding ) attributeBinding.getPluralAttributeElementBinding(); - if ( elementBinding.getPluralAttributeElementNature() != PluralAttributeElementNature.BASIC ) { + if ( elementBinding.getNature() != PluralAttributeElementBinding.Nature.BASIC ) { throw new MappingException( String.format( - "Expected a SetBinding with an element of nature PluralAttributeElementNature.BASIC; instead was %s", - elementBinding.getPluralAttributeElementNature() ), bindingContexts.peek().getOrigin() ); + "Expected a SetBinding with an element of nature Nature.BASIC; instead was %s", + elementBinding.getNature() ), bindingContexts.peek().getOrigin() ); } if ( hasAnyNonNullableColumns( elementBinding.getRelationalValueBindings() ) ) { final PrimaryKey primaryKey = attributeBinding.getPluralAttributeKeyBinding().getCollectionTable().getPrimaryKey(); @@ -473,7 +471,7 @@ public class Binder { attributeSource, indexedAttributeBinding.getAttribute(), indexedAttributeBinding.getPluralAttributeKeyBinding().getCollectionTable() ).get( 0 ).getValue() ); - if ( attributeBinding.getPluralAttributeElementBinding().getPluralAttributeElementNature() == PluralAttributeElementNature.ONE_TO_MANY ) { + if ( attributeBinding.getPluralAttributeElementBinding().getNature() == PluralAttributeElementBinding.Nature.ONE_TO_MANY ) { if ( !Column.class.isInstance( indexBinding.getIndexRelationalValue() ) ) { throw new NotYetImplementedException( "derived value as collection index is not supported yet." ); } @@ -544,15 +542,15 @@ public class Binder { final AbstractPluralAttributeBinding attributeBinding, final PluralAttributeSource attributeSource, final HibernateTypeHelper.ReflectedCollectionJavaTypes reflectedCollectionJavaTypes ) { - PluralAttributeNature pluralAttributeNature = attributeSource.getPluralAttributeNature(); - if ( attributeSource.getElementSource().getNature() == org.hibernate.metamodel.spi.source.PluralAttributeElementNature.ONE_TO_MANY - || pluralAttributeNature == PluralAttributeNature.BAG ) { + PluralAttributeSource.Nature pluralAttributeNature = attributeSource.getNature(); + if ( attributeSource.getElementSource().getNature() == PluralAttributeElementSource.Nature.ONE_TO_MANY + || pluralAttributeNature == PluralAttributeSource.Nature.BAG ) { return; } - if ( attributeBinding.getPluralAttributeElementBinding().getPluralAttributeElementNature() == PluralAttributeElementNature.BASIC ) { - if ( pluralAttributeNature == PluralAttributeNature.SET ) { + if ( attributeBinding.getPluralAttributeElementBinding().getNature() == PluralAttributeElementBinding.Nature.BASIC ) { + if ( pluralAttributeNature == PluralAttributeSource.Nature.SET ) { bindBasicSetElementTablePrimaryKey( attributeBinding ); - } else if ( pluralAttributeNature == PluralAttributeNature.LIST || pluralAttributeNature == PluralAttributeNature.MAP ) { + } else if ( pluralAttributeNature == PluralAttributeSource.Nature.LIST || pluralAttributeNature == PluralAttributeSource.Nature.MAP ) { bindIndexedTablePrimaryKey( ( IndexedPluralAttributeBinding ) attributeBinding ); } else { throw new NotYetImplementedException( "Only Sets with basic elements are supported so far." ); @@ -1207,7 +1205,7 @@ public class Binder { final AbstractPluralAttributeBinding attributeBinding, final PluralAttributeSource attributeSource, final EntityBinding referencedEntityBinding) { - if ( attributeSource.getElementSource().getNature() != org.hibernate.metamodel.spi.source.PluralAttributeElementNature.ONE_TO_MANY ) { + if ( attributeSource.getElementSource().getNature() != PluralAttributeElementSource.Nature.ONE_TO_MANY ) { throw new AssertionFailure( String.format( "Expected one-to-many attribute binding; instead got {%s}", @@ -1219,16 +1217,17 @@ public class Binder { // TODO: Need to look up the table to be able to create the foreign key throw new NotYetImplementedException( "one-to-many using a join table is not supported yet." ); } + if(!attributeSource.isInverse()){ TableSpecification collectionTable = referencedEntityBinding.getPrimaryTable(); bindCollectionTableForeignKey( attributeBinding, attributeSource.getKeySource(), collectionTable ); - + } attributeBinding.getPluralAttributeKeyBinding().setInverse( attributeSource.isInverse() ); } private AbstractPluralAttributeBinding bindPluralAttribute( final AttributeBindingContainer attributeBindingContainer, final PluralAttributeSource attributeSource ) { - final PluralAttributeNature nature = attributeSource.getPluralAttributeNature(); + final PluralAttributeSource.Nature nature = attributeSource.getNature(); final PluralAttribute attribute = attributeBindingContainer.getAttributeContainer().locatePluralAttribute( attributeSource.getName() ); final AbstractPluralAttributeBinding attributeBinding; @@ -1286,14 +1285,14 @@ public class Binder { bindSortingAndOrdering( attributeBinding, attributeSource ); - if ( attributeSource.getElementSource().getNature() == org.hibernate.metamodel.spi.source.PluralAttributeElementNature.BASIC ) { + if ( attributeSource.getElementSource().getNature() == PluralAttributeElementSource.Nature.BASIC ) { bindBasicCollectionKey( attributeBinding, attributeSource ); bindBasicCollectionElement( ( BasicPluralAttributeElementBinding ) attributeBinding.getPluralAttributeElementBinding(), ( BasicPluralAttributeElementSource ) attributeSource.getElementSource(), defaultCollectionElementJavaTypeName( reflectedCollectionJavaTypes ) ); } - else if ( attributeSource.getElementSource().getNature() == org.hibernate.metamodel.spi.source.PluralAttributeElementNature.ONE_TO_MANY ) { + else if ( attributeSource.getElementSource().getNature() == PluralAttributeElementSource.Nature.ONE_TO_MANY ) { final OneToManyPluralAttributeElementSource elementSource = (OneToManyPluralAttributeElementSource) attributeSource.getElementSource(); final String defaultElementJavaTypeName = defaultCollectionElementJavaTypeName( reflectedCollectionJavaTypes ); @@ -1435,7 +1434,7 @@ public class Binder { final AttributeBindingContainer attributeBindingContainer, final SingularAttributeSource attributeSource, boolean isIdentifierAttribute) { - final SingularAttributeNature nature = attributeSource.getNature(); + final SingularAttributeSource.Nature nature = attributeSource.getNature(); final SingularAttribute attribute = attributeBindingContainer.getAttributeContainer().locateSingularAttribute( attributeSource.getName() ); switch ( nature ) { @@ -1466,8 +1465,9 @@ public class Binder { final Sortable sortable = ( Sortable ) attributeSource; if ( sortable.isSorted() ) { Class< Comparator< ? > > comparatorClass = - bindingContext().< Comparator< ? > >locateClassByName( sortable.getComparatorName() ); + bindingContext().locateClassByName( sortable.getComparatorName() ); try { + attributeBinding.setSorted( sortable.isSorted() ); attributeBinding.setComparator( comparatorClass.newInstance() ); } catch ( Exception error ) { bindingContext().makeMappingException( @@ -1874,7 +1874,7 @@ public class Binder { PluralAttributeSource attributeSource ) { return reflectedCollectionJavaTypes != null && reflectedCollectionJavaTypes.getCollectionType() != null ? reflectedCollectionJavaTypes.getCollectionType().getName() - : attributeSource.getPluralAttributeNature().reportedJavaType().getName(); + : attributeSource.getNature().reportedJavaType().getName(); } private List< Column > determineForeignKeyTargetColumns( @@ -2118,15 +2118,16 @@ public class Binder { } } - private PluralAttributeElementNature pluralAttributeElementNature(PluralAttributeSource attributeSource) { - return PluralAttributeElementNature.valueOf( attributeSource.getElementSource().getNature().name() ); + private PluralAttributeElementBinding.Nature pluralAttributeElementNature(PluralAttributeSource attributeSource) { + return PluralAttributeElementBinding.Nature + .valueOf( attributeSource.getElementSource().getNature().name() ); } - private PluralAttributeIndexNature pluralAttributeIndexNature(PluralAttributeSource attributeSource) { + private PluralAttributeIndexBinding.Nature pluralAttributeIndexNature(PluralAttributeSource attributeSource) { if ( ! IndexedPluralAttributeSource.class.isInstance( attributeSource ) ) { return null; } - return PluralAttributeIndexNature.valueOf( + return PluralAttributeIndexBinding.Nature.valueOf( ( (IndexedPluralAttributeSource) attributeSource ).getIndexSource().getNature().name() ); } @@ -2148,7 +2149,7 @@ public class Binder { return metadata.getTypeResolver().getTypeFactory().bag( bagBinding.getAttribute().getRole(), bagBinding.getReferencedPropertyName(), - bagBinding.getPluralAttributeElementBinding().getPluralAttributeElementNature() == PluralAttributeElementNature.COMPOSITE ); + bagBinding.getPluralAttributeElementBinding().getNature() == PluralAttributeElementBinding.Nature.COMPOSITE ); } } @@ -2162,7 +2163,7 @@ public class Binder { pluralAttributeBinding.getAttribute().getName(), pluralAttributeBinding.getReferencedPropertyName(), pluralAttributeBinding.getPluralAttributeElementBinding() - .getPluralAttributeElementNature() == PluralAttributeElementNature.COMPOSITE + .getNature() == PluralAttributeElementBinding.Nature.COMPOSITE ); } @@ -2174,7 +2175,7 @@ public class Binder { listBinding.getAttribute().getRole(), listBinding.getReferencedPropertyName(), listBinding.getPluralAttributeElementBinding() - .getPluralAttributeElementNature() == PluralAttributeElementNature.COMPOSITE + .getNature() == PluralAttributeElementBinding.Nature.COMPOSITE ); } } @@ -2188,7 +2189,7 @@ public class Binder { mapBinding.getAttribute().getRole(), mapBinding.getReferencedPropertyName(), mapBinding.getPluralAttributeElementBinding() - .getPluralAttributeElementNature() == PluralAttributeElementNature.COMPOSITE + .getNature() == PluralAttributeElementBinding.Nature.COMPOSITE ); } } @@ -2201,7 +2202,7 @@ public class Binder { setBinding.getAttribute().getRole(), setBinding.getReferencedPropertyName(), setBinding.getPluralAttributeElementBinding() - .getPluralAttributeElementNature() == PluralAttributeElementNature.COMPOSITE + .getNature() == PluralAttributeElementBinding.Nature.COMPOSITE ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataImpl.java index 52356388ea..c0bbcc92c5 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataImpl.java @@ -30,7 +30,6 @@ import java.util.List; import java.util.Map; import org.jboss.jandex.IndexView; - import org.jboss.logging.Logger; import org.hibernate.AssertionFailure; @@ -69,7 +68,7 @@ import org.hibernate.metamodel.spi.binding.HibernateTypeDescriptor; import org.hibernate.metamodel.spi.binding.IdGenerator; import org.hibernate.metamodel.spi.binding.ManyToOneAttributeBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeElementNature; +import org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeKeyBinding; import org.hibernate.metamodel.spi.binding.RelationalValueBinding; import org.hibernate.metamodel.spi.binding.TypeDefinition; @@ -333,8 +332,8 @@ public class MetadataImpl implements MetadataImplementor, Serializable { // Find one-to-many associations with key bindings that are non-inverse and non-nullable PluralAttributeKeyBinding keyBinding = pluralAttributeBinding.getPluralAttributeKeyBinding(); if ( keyBinding.isInverse() || keyBinding.isNullable() || - pluralAttributeBinding.getPluralAttributeElementBinding().getPluralAttributeElementNature() != - PluralAttributeElementNature.ONE_TO_MANY ) { + pluralAttributeBinding.getPluralAttributeElementBinding().getNature() != + PluralAttributeElementBinding.Nature.ONE_TO_MANY ) { continue; } // Ensure this isn't a bidirectional association by ensuring FK columns don't match relational columns of any diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/SessionFactoryBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/SessionFactoryBuilderImpl.java index c8425c7b95..8b9b56dd25 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/SessionFactoryBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/SessionFactoryBuilderImpl.java @@ -40,12 +40,12 @@ import org.hibernate.cfg.AvailableSettings; import org.hibernate.context.spi.CurrentTenantIdentifierResolver; import org.hibernate.internal.DefaultCustomEntityDirtinessStrategy; import org.hibernate.internal.SessionFactoryImpl; -import org.hibernate.metamodel.spi.MetadataImplementor; -import org.hibernate.service.classloading.spi.StrategyInstanceResolver; import org.hibernate.metamodel.SessionFactoryBuilder; +import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.classloading.spi.ClassLoaderService; +import org.hibernate.service.classloading.spi.StrategyInstanceResolver; import org.hibernate.service.config.spi.ConfigurationService; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/AnnotationBindingContextImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/AnnotationBindingContextImpl.java index 189cb24f62..1b160aa9cf 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/AnnotationBindingContextImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/AnnotationBindingContextImpl.java @@ -32,7 +32,6 @@ import com.fasterxml.classmate.ResolvedTypeWithMembers; import com.fasterxml.classmate.TypeResolver; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; -import org.jboss.jandex.Index; import org.jboss.jandex.IndexView; import org.hibernate.cfg.NamingStrategy; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ComponentAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ComponentAttributeSourceImpl.java index 79b0140293..6a1ec92838 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ComponentAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ComponentAttributeSourceImpl.java @@ -32,18 +32,17 @@ import java.util.Map; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.ValueHolder; import org.hibernate.mapping.PropertyGeneration; -import org.hibernate.metamodel.internal.source.annotations.entity.EmbeddableClass; -import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; -import org.hibernate.metamodel.spi.source.LocalBindingContext; import org.hibernate.metamodel.internal.source.annotations.attribute.AssociationAttribute; import org.hibernate.metamodel.internal.source.annotations.attribute.AttributeOverride; import org.hibernate.metamodel.internal.source.annotations.attribute.BasicAttribute; +import org.hibernate.metamodel.internal.source.annotations.entity.EmbeddableClass; +import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.AttributeSource; import org.hibernate.metamodel.spi.source.ComponentAttributeSource; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; +import org.hibernate.metamodel.spi.source.LocalBindingContext; import org.hibernate.metamodel.spi.source.MetaAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; /** * Annotation backed implementation of {@code ComponentAttributeSource}. @@ -71,8 +70,8 @@ public class ComponentAttributeSourceImpl implements ComponentAttributeSource { } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.COMPONENT; + public Nature getNature() { + return Nature.COMPONENT; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/DerivedValueSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/DerivedValueSourceImpl.java index 58269d899e..eb59ae7899 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/DerivedValueSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/DerivedValueSourceImpl.java @@ -25,7 +25,6 @@ package org.hibernate.metamodel.internal.source.annotations; import org.hibernate.metamodel.internal.source.annotations.attribute.FormulaValue; import org.hibernate.metamodel.spi.source.DerivedValueSource; -import org.hibernate.metamodel.spi.source.RelationalValueSource; /** * @author Strong Liu diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/EntitySourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/EntitySourceImpl.java index 5c80299e64..6ed629d67e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/EntitySourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/EntitySourceImpl.java @@ -36,8 +36,8 @@ import org.jboss.jandex.AnnotationValue; import org.hibernate.AnnotationException; import org.hibernate.MappingException; import org.hibernate.cfg.NotYetImplementedException; -import org.hibernate.jaxb.spi.Origin; import org.hibernate.internal.util.StringHelper; +import org.hibernate.jaxb.spi.Origin; import org.hibernate.metamodel.internal.source.annotations.attribute.AssociationAttribute; import org.hibernate.metamodel.internal.source.annotations.attribute.AttributeOverride; import org.hibernate.metamodel.internal.source.annotations.attribute.BasicAttribute; @@ -47,6 +47,7 @@ import org.hibernate.metamodel.internal.source.annotations.entity.EntityClass; import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; +import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.binding.CustomSQL; import org.hibernate.metamodel.spi.source.AttributeSource; import org.hibernate.metamodel.spi.source.ConstraintSource; @@ -54,7 +55,6 @@ import org.hibernate.metamodel.spi.source.EntitySource; import org.hibernate.metamodel.spi.source.JpaCallbackSource; import org.hibernate.metamodel.spi.source.LocalBindingContext; import org.hibernate.metamodel.spi.source.MetaAttributeSource; -import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.source.PrimaryKeyJoinColumnSource; import org.hibernate.metamodel.spi.source.SecondaryTableSource; import org.hibernate.metamodel.spi.source.SubclassEntitySource; @@ -229,18 +229,18 @@ public class EntitySourceImpl implements EntitySource { } for ( AssociationAttribute associationAttribute : entityClass.getAssociationAttributes() ) { - switch ( associationAttribute.getAttributeNature() ) { + switch ( associationAttribute.getNature() ) { case ONE_TO_ONE: case MANY_TO_ONE: { attributeList.add( new ToOneAttributeSourceImpl( associationAttribute ) ); break; } - case MANY_TO_MANY: { - attributeList.add( new PluralAttributeSourceImpl( ( PluralAssociationAttribute ) associationAttribute ) ); - break; - } + case MANY_TO_MANY: case ONE_TO_MANY: - attributeList.add( new PluralAttributeSourceImpl( ( PluralAssociationAttribute ) associationAttribute ) ); + AttributeSource source = ((PluralAssociationAttribute)associationAttribute).isIndexed() ? + new IndexedPluralAttributeSourceImpl((PluralAssociationAttribute)associationAttribute ) + :new PluralAttributeSourceImpl( ( PluralAssociationAttribute ) associationAttribute ); + attributeList.add( source ); break; default: { throw new NotYetImplementedException(); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorExtractionDelegate.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorExtractionDelegate.java index 192cbe2eca..60fdaa7dbf 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorExtractionDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorExtractionDelegate.java @@ -23,15 +23,14 @@ */ package org.hibernate.metamodel.internal.source.annotations; -import javax.persistence.GenerationType; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.persistence.GenerationType; import org.jboss.jandex.AnnotationInstance; - import org.jboss.logging.Logger; import org.hibernate.cfg.AvailableSettings; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorSourceContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorSourceContainer.java index 6692789882..99856133de 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorSourceContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IdentifierGeneratorSourceContainer.java @@ -24,7 +24,6 @@ package org.hibernate.metamodel.internal.source.annotations; import java.util.Collection; -import java.util.List; import org.jboss.jandex.AnnotationInstance; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IndexedPluralAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IndexedPluralAttributeSourceImpl.java new file mode 100644 index 0000000000..4f67f31b38 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/IndexedPluralAttributeSourceImpl.java @@ -0,0 +1,37 @@ +package org.hibernate.metamodel.internal.source.annotations; + +import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; +import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute; +import org.hibernate.metamodel.spi.source.IndexedPluralAttributeSource; +import org.hibernate.metamodel.spi.source.MappingException; +import org.hibernate.metamodel.spi.source.PluralAttributeIndexSource; + +/** + * @author Strong Liu + */ +public class IndexedPluralAttributeSourceImpl extends PluralAttributeSourceImpl + implements IndexedPluralAttributeSource { + private final PluralAttributeIndexSource indexSource; + + public IndexedPluralAttributeSourceImpl(PluralAssociationAttribute attribute) { + super( attribute ); + if ( getNature() == org.hibernate.metamodel.spi.source.PluralAttributeSource.Nature.SET || getNature() == org.hibernate.metamodel.spi.source.PluralAttributeSource.Nature.MAP ) { + throw new MappingException( + "Set / Map could not be an indexed column", + attribute.getContext().getOrigin() + ); + } + if ( attribute.getNature() != MappedAttribute.Nature.MANY_TO_MANY && attribute.getNature() != MappedAttribute.Nature.ONE_TO_MANY ) { + throw new MappingException( + "Indexed column could be only mapped on the MANY side", + attribute.getContext().getOrigin() + ); + } + this.indexSource = new PluralAttributeIndexSourceImpl( this, attribute ); + } + + @Override + public PluralAttributeIndexSource getIndexSource() { + return indexSource; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ManyToManyPluralAttributeElementSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ManyToManyPluralAttributeElementSourceImpl.java index ad7d0c5668..14a7c89121 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ManyToManyPluralAttributeElementSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ManyToManyPluralAttributeElementSourceImpl.java @@ -33,7 +33,6 @@ import org.hibernate.metamodel.internal.source.annotations.attribute.Column; import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute; import org.hibernate.metamodel.spi.binding.CascadeType; import org.hibernate.metamodel.spi.source.ManyToManyPluralAttributeElementSource; -import org.hibernate.metamodel.spi.source.PluralAttributeElementNature; import org.hibernate.metamodel.spi.source.RelationalValueSource; /** @@ -86,7 +85,7 @@ public class ManyToManyPluralAttributeElementSourceImpl implements ManyToManyPlu @Override public boolean isNotFoundAnException() { - return !associationAttribute.ignoreNotFound(); + return !associationAttribute.isIgnoreNotFound(); } @Override @@ -115,8 +114,8 @@ public class ManyToManyPluralAttributeElementSourceImpl implements ManyToManyPlu } @Override - public PluralAttributeElementNature getNature() { - return PluralAttributeElementNature.MANY_TO_MANY; + public Nature getNature() { + return Nature.MANY_TO_MANY; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/OneToManyPluralAttributeElementSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/OneToManyPluralAttributeElementSourceImpl.java index 2abfa8f173..a3d5b3010b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/OneToManyPluralAttributeElementSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/OneToManyPluralAttributeElementSourceImpl.java @@ -29,7 +29,6 @@ import org.hibernate.AssertionFailure; import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute; import org.hibernate.metamodel.spi.source.OneToManyPluralAttributeElementSource; -import org.hibernate.metamodel.spi.source.PluralAttributeElementNature; /** * @author Hardy Ferentschik @@ -48,7 +47,7 @@ public class OneToManyPluralAttributeElementSourceImpl implements OneToManyPlura @Override public boolean isNotFoundAnException() { - return !associationAttribute.ignoreNotFound(); + return !associationAttribute.isIgnoreNotFound(); } @Override @@ -58,28 +57,29 @@ public class OneToManyPluralAttributeElementSourceImpl implements OneToManyPlura } @Override - public PluralAttributeElementNature getNature() { - switch ( associationAttribute.getAttributeNature() ) { + public Nature getNature() { + switch ( associationAttribute.getNature() ) { case MANY_TO_MANY: { - return PluralAttributeElementNature.MANY_TO_MANY; + return Nature.MANY_TO_MANY; } case MANY_TO_ANY: { - return PluralAttributeElementNature.MANY_TO_ANY; + return Nature.MANY_TO_ANY; } case ONE_TO_MANY: { - return PluralAttributeElementNature.ONE_TO_MANY; + return Nature.ONE_TO_MANY; } case ELEMENT_COLLECTION_BASIC: { - return PluralAttributeElementNature.BASIC; + return Nature.BASIC; } case ELEMENT_COLLECTION_EMBEDDABLE: { - return PluralAttributeElementNature.COMPONENT; + return Nature.COMPONENT; } default: { - throw new AssertionFailure( "Unexpected attribute nature: " + associationAttribute.getAttributeNature() ); + throw new AssertionFailure( "Unexpected attribute nature: " + associationAttribute.getNature() ); } } } + } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeIndexSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeIndexSourceImpl.java new file mode 100644 index 0000000000..06dafe8956 --- /dev/null +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeIndexSourceImpl.java @@ -0,0 +1,61 @@ +package org.hibernate.metamodel.internal.source.annotations; + +import java.util.List; + +import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute; +import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; +import org.hibernate.metamodel.spi.source.PluralAttributeIndexSource; +import org.hibernate.metamodel.spi.source.RelationalValueSource; + +/** + * @author Strong Liu + */ +public class PluralAttributeIndexSourceImpl implements PluralAttributeIndexSource { + private final PluralAssociationAttribute attribute; + private final IndexedPluralAttributeSourceImpl indexedPluralAttributeSource; + + public PluralAttributeIndexSourceImpl(IndexedPluralAttributeSourceImpl indexedPluralAttributeSource, PluralAssociationAttribute attribute) { + this.attribute = attribute; + this.indexedPluralAttributeSource = indexedPluralAttributeSource; + } + + @Override + public Nature getNature() { + switch ( indexedPluralAttributeSource.getElementSource().getNature() ){ + case BASIC: + return Nature.BASIC; + case COMPONENT: + return Nature.COMPOSITE; + case MANY_TO_ANY: + return Nature.MANY_TO_ANY; + case MANY_TO_MANY: + return Nature.MANY_TO_MANY; + } + return null; + } + + @Override + public ExplicitHibernateTypeSource explicitHibernateTypeSource() { + return null; + } + + @Override + public List relationalValueSources() { + return null; + } + + @Override + public boolean areValuesIncludedInInsertByDefault() { + return false; + } + + @Override + public boolean areValuesIncludedInUpdateByDefault() { + return false; + } + + @Override + public boolean areValuesNullableByDefault() { + return false; + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeKeySourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeKeySourceImpl.java index 3c3e015c91..1ebc1e66d1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeKeySourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeKeySourceImpl.java @@ -23,9 +23,13 @@ */ package org.hibernate.metamodel.internal.source.annotations; +import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.hibernate.annotations.OnDeleteAction; +import org.hibernate.metamodel.internal.source.annotations.attribute.Column; +import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute; import org.hibernate.metamodel.spi.relational.ForeignKey; import org.hibernate.metamodel.spi.relational.Value; import org.hibernate.metamodel.spi.source.PluralAttributeKeySource; @@ -33,37 +37,52 @@ import org.hibernate.metamodel.spi.source.RelationalValueSource; /** * @author Hardy Ferentschik + * @author Strong Liu */ public class PluralAttributeKeySourceImpl implements PluralAttributeKeySource { + private final PluralAssociationAttribute attribute; + private final ForeignKey.ReferentialAction deleteAction; + + public PluralAttributeKeySourceImpl(PluralAssociationAttribute attribute) { + this.attribute = attribute; + this.deleteAction = attribute.getOnDeleteAction() == OnDeleteAction.CASCADE + ? ForeignKey.ReferentialAction.CASCADE : ForeignKey.ReferentialAction.NO_ACTION; + } + @Override public List getValueSources() { - // TODO - return Collections.emptyList(); + List valueSources = new ArrayList(); + if ( !attribute.getColumnValues().isEmpty() ) { + for ( Column columnValues : attribute.getColumnValues() ) { + valueSources.add( new ColumnSourceImpl( attribute, null, columnValues ) ); + } + } + return valueSources; } @Override public ForeignKey.ReferentialAction getOnDeleteAction() { - return null; //To change body of implemented methods use File | Settings | File Templates. + return deleteAction; } @Override public boolean areValuesIncludedInInsertByDefault() { - return false; //To change body of implemented methods use File | Settings | File Templates. + return true; } @Override public boolean areValuesIncludedInUpdateByDefault() { - return false; //To change body of implemented methods use File | Settings | File Templates. + return false; } @Override public boolean areValuesNullableByDefault() { - return false; //To change body of implemented methods use File | Settings | File Templates. + return true; } @Override public String getExplicitForeignKeyName() { - return null; //To change body of implemented methods use File | Settings | File Templates. + return null; } @Override @@ -89,5 +108,3 @@ public class PluralAttributeKeySourceImpl implements PluralAttributeKeySource { } } } - - diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java index 6dc43b4fdb..99bbcce3e4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/PluralAttributeSourceImpl.java @@ -27,83 +27,108 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; +import javax.persistence.CascadeType; import org.hibernate.FetchMode; import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchTiming; import org.hibernate.engine.spi.CascadeStyle; +import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute; +import org.hibernate.metamodel.internal.source.annotations.util.EnumConversionHelper; import org.hibernate.metamodel.spi.binding.Caching; import org.hibernate.metamodel.spi.binding.CustomSQL; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.ManyToAnyPluralAttributeElementSource; import org.hibernate.metamodel.spi.source.MetaAttributeSource; -import org.hibernate.metamodel.spi.source.PluralAttributeElementNature; +import org.hibernate.metamodel.spi.source.OneToManyPluralAttributeElementSource; +import org.hibernate.metamodel.spi.source.Orderable; import org.hibernate.metamodel.spi.source.PluralAttributeElementSource; import org.hibernate.metamodel.spi.source.PluralAttributeKeySource; -import org.hibernate.metamodel.spi.source.PluralAttributeNature; import org.hibernate.metamodel.spi.source.PluralAttributeSource; +import org.hibernate.metamodel.spi.source.Sortable; import org.hibernate.metamodel.spi.source.TableSpecificationSource; /** * @author Hardy Ferentschik */ -public class PluralAttributeSourceImpl implements PluralAttributeSource { +public class PluralAttributeSourceImpl implements PluralAttributeSource, Orderable, Sortable { private final PluralAssociationAttribute attribute; - private final PluralAttributeNature nature; + private final Nature nature; + private final ExplicitHibernateTypeSource typeSource; + private final PluralAttributeKeySource keySource; + private final PluralAttributeElementSource elementSource; - public PluralAttributeSourceImpl(PluralAssociationAttribute attribute) { + public PluralAttributeSourceImpl(final PluralAssociationAttribute attribute) { this.attribute = attribute; this.nature = resolveAttributeNature(); + this.keySource = new PluralAttributeKeySourceImpl( attribute ); + this.elementSource = determineElementSource(); + this.typeSource = new ExplicitHibernateTypeSource() { + @Override + public String getName() { + return attribute.getHibernateTypeResolver().getExplicitHibernateTypeName(); + } + + @Override + public Map getParameters() { + return attribute.getHibernateTypeResolver().getExplicitHibernateTypeParameters(); + } + }; } - private PluralAttributeNature resolveAttributeNature() { + private Nature resolveAttributeNature() { if ( Map.class.isAssignableFrom( attribute.getAttributeType() ) ) { - return PluralAttributeNature.MAP; + return PluralAttributeSource.Nature.MAP; } else if ( List.class.isAssignableFrom( attribute.getAttributeType() ) ) { - return PluralAttributeNature.LIST; + return PluralAttributeSource.Nature.LIST; } else if ( Set.class.isAssignableFrom( attribute.getAttributeType() ) ) { - return PluralAttributeNature.SET; + return PluralAttributeSource.Nature.SET; } else { - return PluralAttributeNature.BAG; + return PluralAttributeSource.Nature.BAG; } } @Override - public PluralAttributeNature getPluralAttributeNature() { + public Nature getNature() { return nature; } @Override - public PluralAttributeKeySource getKeySource() { - return new PluralAttributeKeySourceImpl( ); + public PluralAttributeElementSource getElementSource() { + return elementSource; } - @Override - public PluralAttributeElementSource getElementSource() { - switch ( attribute.getAttributeNature() ) { + private PluralAttributeElementSource determineElementSource (){ + switch ( attribute.getNature() ) { case MANY_TO_MANY: return new ManyToManyPluralAttributeElementSourceImpl( attribute ); case MANY_TO_ANY: - return new ManyToAnyPluralAttributeElementSourceImpl(); + return new ManyToAnyPluralAttributeElementSourceImpl( attribute ); case ONE_TO_MANY: return new OneToManyPluralAttributeElementSourceImpl( attribute ); } - return null; + throw new AssertionError( "unexpected attribute nature" ); + } + + @Override + public PluralAttributeKeySource getKeySource() { + return keySource; } @Override public TableSpecificationSource getCollectionTableSpecificationSource() { - return null; //To change body of implemented methods use File | Settings | File Templates. + // todo see org.hibernate.metamodel.internal.Binder#bindOneToManyCollectionKey + return null; } @Override public String getCollectionTableComment() { - return null; //To change body of implemented methods use File | Settings | File Templates. + return null; } @Override @@ -128,7 +153,7 @@ public class PluralAttributeSourceImpl implements PluralAttributeSource { @Override public boolean isInverse() { - return attribute.getMappedBy() == null; + return attribute.getMappedBy() != null; } @Override @@ -168,17 +193,17 @@ public class PluralAttributeSourceImpl implements PluralAttributeSource { @Override public ExplicitHibernateTypeSource getTypeInformation() { - return null; //To change body of implemented methods use File | Settings | File Templates. + return typeSource; } @Override public String getPropertyAccessorName() { - return null; //To change body of implemented methods use File | Settings | File Templates. + return attribute.getAccessType(); } @Override public boolean isIncludedInOptimisticLocking() { - return false; //To change body of implemented methods use File | Settings | File Templates. + return attribute.isOptimisticLockable(); } @Override @@ -192,6 +217,26 @@ public class PluralAttributeSourceImpl implements PluralAttributeSource { return attribute.getFetchMode(); } + @Override + public String getOrder() { + return attribute.getOrderBy(); + } + + @Override + public boolean isOrdered() { + return StringHelper.isNotEmpty( getOrder() ); + } + + @Override + public String getComparatorName() { + return attribute.getComparatorName(); + } + + @Override + public boolean isSorted() { + return attribute.isSorted(); + } + @Override public FetchTiming getFetchTiming() { if ( attribute.isExtraLazy() ) { @@ -207,17 +252,55 @@ public class PluralAttributeSourceImpl implements PluralAttributeSource { public FetchStyle getFetchStyle() { return attribute.getFetchStyle(); } + public Iterable interpretCascadeStyles(Set cascadeTypes) { + return EnumConversionHelper.cascadeTypeToCascadeStyleSet( cascadeTypes, attribute.getContext() ); - private class ManyToAnyPluralAttributeElementSourceImpl implements ManyToAnyPluralAttributeElementSource { - @Override - public Iterable getCascadeStyles() { - return null; //To change body of implemented methods use File | Settings | File Templates. + } + + private class OneToManyPluralAttributeElementSourceImpl implements OneToManyPluralAttributeElementSource { + private final PluralAssociationAttribute attribute; + + private OneToManyPluralAttributeElementSourceImpl(PluralAssociationAttribute attribute) { + this.attribute = attribute; } @Override - public PluralAttributeElementNature getNature() { - return null; //To change body of implemented methods use File | Settings | File Templates. + public String getReferencedEntityName() { + return attribute.getReferencedEntityType(); + } + + @Override + public boolean isNotFoundAnException() { + return !attribute.isIgnoreNotFound(); + } + + @Override + public Iterable getCascadeStyles() { + return interpretCascadeStyles( attribute.getCascadeTypes() ); + } + + @Override + public Nature getNature() { + return Nature.ONE_TO_MANY; + } + } + + private class ManyToAnyPluralAttributeElementSourceImpl implements ManyToAnyPluralAttributeElementSource { + private final PluralAssociationAttribute attribute; + + private ManyToAnyPluralAttributeElementSourceImpl(PluralAssociationAttribute attribute) { + this.attribute = attribute; + } + + @Override + public Iterable getCascadeStyles() { + return interpretCascadeStyles( attribute.getCascadeTypes() ); + } + + @Override + public Nature getNature() { + return Nature.MANY_TO_ANY; } } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/SingularAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/SingularAttributeSourceImpl.java index bd010e9084..a813cbaa63 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/SingularAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/SingularAttributeSourceImpl.java @@ -36,7 +36,6 @@ import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.MetaAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.SingularAttributeSource; /** @@ -115,8 +114,8 @@ public class SingularAttributeSourceImpl implements SingularAttributeSource { } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java index 89e7f13af3..2fe7c772dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/ToOneAttributeSourceImpl.java @@ -40,7 +40,6 @@ import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; import org.hibernate.metamodel.spi.relational.Value; import org.hibernate.metamodel.spi.source.ForeignKeyContributingSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.ToOneAttributeSource; /** @@ -53,12 +52,13 @@ public class ToOneAttributeSourceImpl extends SingularAttributeSourceImpl implem public ToOneAttributeSourceImpl(AssociationAttribute associationAttribute) { super( associationAttribute ); this.associationAttribute = associationAttribute; - this.cascadeStyles = EnumConversionHelper.cascadeTypeToCascadeStyleSet( associationAttribute.getCascadeTypes() ); + + this.cascadeStyles = EnumConversionHelper.cascadeTypeToCascadeStyleSet( associationAttribute.getCascadeTypes(), associationAttribute.getContext() ); } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.MANY_TO_ONE; + public Nature getNature() { + return Nature.MANY_TO_ONE; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AssociationAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AssociationAttribute.java index 6a56ff1b5c..460406674d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AssociationAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AssociationAttribute.java @@ -74,45 +74,20 @@ public class AssociationAttribute extends MappedAttribute { public static AssociationAttribute createAssociationAttribute( String name, Class attributeType, - AttributeNature attributeNature, + Nature attributeNature, String accessType, Map> annotations, EntityBindingContext context) { - return createAssociationAttribute( - name, - attributeType, - attributeType, - attributeNature, - accessType, - annotations, - context - ); + return new AssociationAttribute( name, attributeType, attributeType, attributeNature, accessType, annotations, context ); } - public static AssociationAttribute createAssociationAttribute( - String name, - Class attributeType, - Class referencedAttributeType, - AttributeNature attributeNature, - String accessType, - Map> annotations, - EntityBindingContext context) { - return new AssociationAttribute( - name, - attributeType, - referencedAttributeType, - attributeNature, - accessType, - annotations, - context - ); - } + AssociationAttribute( String name, Class attributeType, Class referencedAttributeType, - AttributeNature attributeNature, + Nature attributeNature, String accessType, Map> annotations, EntityBindingContext context) { @@ -138,7 +113,7 @@ public class AssociationAttribute extends MappedAttribute { this.mapsId = referencedIdAttributeName != null; } - public boolean ignoreNotFound() { + public boolean isIgnoreNotFound() { return ignoreNotFound; } @@ -341,8 +316,8 @@ public class AssociationAttribute extends MappedAttribute { return null; } - if ( !( AttributeNature.MANY_TO_ONE.equals( getAttributeNature() ) || AttributeNature.MANY_TO_ONE - .equals( getAttributeNature() ) ) ) { + if ( !( Nature.MANY_TO_ONE.equals( getNature() ) || Nature.MANY_TO_ONE + .equals( getNature() ) ) ) { throw new MappingException( "@MapsId can only be specified on a many-to-one or one-to-one associations", getContext().getOrigin() diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AttributeNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AttributeNature.java deleted file mode 100644 index b7fc572ab2..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/AttributeNature.java +++ /dev/null @@ -1,57 +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.internal.source.annotations.attribute; - -import org.jboss.jandex.DotName; - -import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames; -import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; - -/** - * An enum defining the type of a mapped attribute from the JPA perspective. - * - * @author Hardy Ferentschik - */ -public enum AttributeNature { - BASIC( JPADotNames.BASIC ), - ONE_TO_ONE( JPADotNames.ONE_TO_ONE ), - ONE_TO_MANY( JPADotNames.ONE_TO_MANY ), - MANY_TO_ONE( JPADotNames.MANY_TO_ONE ), - MANY_TO_MANY( JPADotNames.MANY_TO_MANY ), - MANY_TO_ANY( HibernateDotNames.MANY_TO_ANY ), - ELEMENT_COLLECTION_BASIC( JPADotNames.ELEMENT_COLLECTION ), - ELEMENT_COLLECTION_EMBEDDABLE( JPADotNames.ELEMENT_COLLECTION ), - EMBEDDED_ID( JPADotNames.EMBEDDED_ID ), - EMBEDDED( JPADotNames.EMBEDDED ); - - private final DotName annotationDotName; - - AttributeNature(DotName annotationDotName) { - this.annotationDotName = annotationDotName; - } - - public DotName getAnnotationDotName() { - return annotationDotName; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/BasicAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/BasicAttribute.java index aabc00b8f9..a1a743151c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/BasicAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/BasicAttribute.java @@ -23,14 +23,14 @@ */ package org.hibernate.metamodel.internal.source.annotations.attribute; -import javax.persistence.FetchType; -import javax.persistence.GenerationType; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import javax.persistence.FetchType; +import javax.persistence.GenerationType; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationValue; @@ -101,7 +101,7 @@ public class BasicAttribute extends MappedAttribute { public static BasicAttribute createSimpleAttribute(String name, Class attributeType, - AttributeNature attributeNature, + Nature attributeNature, Map> annotations, String accessType, EntityBindingContext context) { @@ -110,7 +110,7 @@ public class BasicAttribute extends MappedAttribute { BasicAttribute(String name, Class attributeType, - AttributeNature attributeNature, + Nature attributeNature, String accessType, Map> annotations, EntityBindingContext context) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/MappedAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/MappedAttribute.java index 5075204975..b9bf5f92dc 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/MappedAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/MappedAttribute.java @@ -32,11 +32,11 @@ import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.DotName; import org.hibernate.mapping.PropertyGeneration; +import org.hibernate.metamodel.internal.source.annotations.attribute.type.AttributeTypeResolver; +import org.hibernate.metamodel.internal.source.annotations.entity.EntityBindingContext; import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; -import org.hibernate.metamodel.internal.source.annotations.attribute.type.AttributeTypeResolver; -import org.hibernate.metamodel.internal.source.annotations.entity.EntityBindingContext; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; /** @@ -63,7 +63,7 @@ public abstract class MappedAttribute implements Comparable { /** * The nature of the attribute */ - AttributeNature attributeNature; + Nature attributeNature; /** * The access type for this property. At the moment this is either 'field' or 'property', but Hibernate @@ -104,7 +104,7 @@ public abstract class MappedAttribute implements Comparable { */ private final EntityBindingContext context; - MappedAttribute(String name, Class attributeType, AttributeNature attributeNature, + MappedAttribute(String name, Class attributeType, Nature attributeNature, String accessType, Map> annotations, EntityBindingContext context) { this.context = context; @@ -168,7 +168,7 @@ public abstract class MappedAttribute implements Comparable { this.naturalIdMutability = naturalIdMutability; } - public AttributeNature getAttributeNature() { + public Nature getNature() { return attributeNature; } @@ -285,6 +285,33 @@ public abstract class MappedAttribute implements Comparable { } return checkCondition; } + /** + * An enum defining the type of a mapped attribute. + * + * @author Hardy Ferentschik + */ + public static enum Nature { + BASIC( JPADotNames.BASIC ), + ONE_TO_ONE( JPADotNames.ONE_TO_ONE ), + ONE_TO_MANY( JPADotNames.ONE_TO_MANY ), + MANY_TO_ONE( JPADotNames.MANY_TO_ONE ), + MANY_TO_MANY( JPADotNames.MANY_TO_MANY ), + MANY_TO_ANY( HibernateDotNames.MANY_TO_ANY ), + ELEMENT_COLLECTION_BASIC( JPADotNames.ELEMENT_COLLECTION ), + ELEMENT_COLLECTION_EMBEDDABLE( JPADotNames.ELEMENT_COLLECTION ), + EMBEDDED_ID( JPADotNames.EMBEDDED_ID ), + EMBEDDED( JPADotNames.EMBEDDED ); + + private final DotName annotationDotName; + + Nature(DotName annotationDotName) { + this.annotationDotName = annotationDotName; + } + + public DotName getAnnotationDotName() { + return annotationDotName; + } + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java index 76109f60da..3535d3fab5 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/PluralAssociationAttribute.java @@ -33,6 +33,8 @@ import org.jboss.jandex.DotName; import org.hibernate.AnnotationException; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.LazyCollectionOption; +import org.hibernate.annotations.OnDeleteAction; +import org.hibernate.annotations.SortType; import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.internal.source.annotations.entity.EntityBindingContext; import org.hibernate.metamodel.internal.source.annotations.util.AnnotationParserHelper; @@ -41,15 +43,19 @@ import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; import org.hibernate.metamodel.spi.binding.Caching; import org.hibernate.metamodel.spi.binding.CustomSQL; +import org.hibernate.metamodel.spi.source.MappingException; /** * Represents an collection (collection, list, set, map) association attribute. * * @author Hardy Ferentschik + * @author Strong Liu */ public class PluralAssociationAttribute extends AssociationAttribute { private final String whereClause; private final String orderBy; + private final boolean sorted; + private final String comparatorName; private final Caching caching; private final String customPersister; private final String customLoaderName; @@ -59,6 +65,8 @@ public class PluralAssociationAttribute extends AssociationAttribute { private final CustomSQL customDeleteAll; private final ClassInfo entityClassInfo; private final boolean isExtraLazy; + private final OnDeleteAction onDeleteAction; + private final boolean isIndexed; // Used for the non-owning side of a ManyToMany relationship private final String inverseForeignKeyName; @@ -68,7 +76,7 @@ public class PluralAssociationAttribute extends AssociationAttribute { String name, Class attributeType, Class referencedAttributeType, - AttributeNature attributeNature, + Nature attributeNature, String accessType, Map> annotations, EntityBindingContext context) { @@ -132,12 +140,27 @@ public class PluralAssociationAttribute extends AssociationAttribute { sb.append( '}' ); return sb.toString(); } + public OnDeleteAction getOnDeleteAction() { + return onDeleteAction; + } + + public String getComparatorName() { + return comparatorName; + } + + public boolean isSorted() { + return sorted; + } + + public boolean isIndexed() { + return isIndexed; + } private PluralAssociationAttribute(ClassInfo entityClassInfo, String name, Class attributeType, Class referencedAttributeType, - AttributeNature associationType, + Nature associationType, String accessType, Map> annotations, EntityBindingContext context) { @@ -162,6 +185,48 @@ public class PluralAssociationAttribute extends AssociationAttribute { this.customDeleteAll = AnnotationParserHelper.processCustomSqlAnnotation( HibernateDotNames.SQL_DELETE_ALL, annotations() ); + this.onDeleteAction = determineOnDeleteAction(); + + final AnnotationInstance sortAnnotation = JandexHelper.getSingleAnnotation( annotations, HibernateDotNames.SORT ); + if ( sortAnnotation == null ) { + this.sorted = false; + this.comparatorName = null; + } + else { + final SortType sortType = JandexHelper.getEnumValue( sortAnnotation, "type", SortType.class ); + this.sorted = sortType != SortType.UNSORTED; + if ( this.sorted && sortType == SortType.COMPARATOR ) { + String comparatorName = JandexHelper.getValue( sortAnnotation, "comparator", String.class ); + if ( StringHelper.isEmpty( comparatorName ) ) { + throw new MappingException( + "Comparator class must be provided when using SortType.COMPARATOR.", + getContext().getOrigin() + ); + } + this.comparatorName = comparatorName; + } + else { + this.comparatorName = null; + } + } + + AnnotationInstance orderColumnAnnotation = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ORDER_COLUMN ); + AnnotationInstance indexColumnAnnotation = JandexHelper.getSingleAnnotation( annotations, HibernateDotNames.INDEX_COLUMN ); + this.isIndexed = orderColumnAnnotation != null || indexColumnAnnotation != null; + + } + + private OnDeleteAction determineOnDeleteAction() { + + OnDeleteAction action = null; + final AnnotationInstance onDeleteAnnotation = JandexHelper.getSingleAnnotation( + annotations(), + HibernateDotNames.ON_DELETE + ); + if ( onDeleteAnnotation != null ) { + action = JandexHelper.getValue( onDeleteAnnotation, "action", OnDeleteAction.class ); + } + return action; } private String determineCustomLoaderName() { @@ -209,12 +274,12 @@ public class PluralAssociationAttribute extends AssociationAttribute { HibernateDotNames.LAZY_COLLECTION ); if ( lazyCollectionAnnotationInstance != null ) { - LazyCollectionOption option = JandexHelper.getEnumValue( + lazyOption = JandexHelper.getEnumValue( lazyCollectionAnnotationInstance, "value", LazyCollectionOption.class ); - return option == LazyCollectionOption.TRUE; + return lazyOption == LazyCollectionOption.TRUE; } return lazy; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/AttributeTypeResolverImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/AttributeTypeResolverImpl.java index 912bfdb748..4ca0cbd463 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/AttributeTypeResolverImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/AttributeTypeResolverImpl.java @@ -30,9 +30,9 @@ import java.util.Map; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationValue; +import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; -import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; /** * Type Resolver which checks {@link org.hibernate.annotations.Type} to find the type info. diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/EnumeratedTypeResolver.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/EnumeratedTypeResolver.java index cf2e12ab86..c6e090db55 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/EnumeratedTypeResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/EnumeratedTypeResolver.java @@ -32,9 +32,9 @@ import org.jboss.jandex.AnnotationInstance; import org.hibernate.AnnotationException; import org.hibernate.AssertionFailure; +import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; -import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; import org.hibernate.type.EnumType; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/ExplicitHibernateTypeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/ExplicitHibernateTypeSourceImpl.java index 9b3f147728..4305183f0d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/ExplicitHibernateTypeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/ExplicitHibernateTypeSourceImpl.java @@ -25,7 +25,6 @@ package org.hibernate.metamodel.internal.source.annotations.attribute.type; import java.util.Map; -import org.hibernate.metamodel.internal.source.annotations.attribute.type.AttributeTypeResolver; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/LobTypeResolver.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/LobTypeResolver.java index a389a43ddf..dcf38be7a0 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/LobTypeResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/LobTypeResolver.java @@ -33,9 +33,9 @@ import java.util.Map; import org.jboss.jandex.AnnotationInstance; import org.hibernate.AssertionFailure; +import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; -import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; import org.hibernate.type.CharacterArrayClobType; import org.hibernate.type.PrimitiveCharacterArrayClobType; import org.hibernate.type.SerializableToBlobType; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/TemporalTypeResolver.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/TemporalTypeResolver.java index c26ca9aefd..701a8dccdf 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/TemporalTypeResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/attribute/type/TemporalTypeResolver.java @@ -33,9 +33,9 @@ import org.jboss.jandex.AnnotationInstance; import org.hibernate.AnnotationException; import org.hibernate.AssertionFailure; import org.hibernate.cfg.NotYetImplementedException; +import org.hibernate.metamodel.internal.source.annotations.attribute.BasicAttribute; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; -import org.hibernate.metamodel.internal.source.annotations.attribute.BasicAttribute; import org.hibernate.type.StandardBasicTypes; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/ConfiguredClass.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/ConfiguredClass.java index 54419b6c19..d214c7d07e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/ConfiguredClass.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/ConfiguredClass.java @@ -57,9 +57,9 @@ import org.hibernate.HibernateException; import org.hibernate.cfg.NotYetImplementedException; import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext; import org.hibernate.metamodel.internal.source.annotations.attribute.AssociationAttribute; -import org.hibernate.metamodel.internal.source.annotations.attribute.AttributeNature; import org.hibernate.metamodel.internal.source.annotations.attribute.AttributeOverride; import org.hibernate.metamodel.internal.source.annotations.attribute.BasicAttribute; +import org.hibernate.metamodel.internal.source.annotations.attribute.MappedAttribute; import org.hibernate.metamodel.internal.source.annotations.attribute.PluralAssociationAttribute; import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; @@ -433,7 +433,7 @@ public class ConfiguredClass { classInfo, member.getName() ); - AttributeNature attributeNature = determineAttributeNature( annotations, referencedEntityType ); + MappedAttribute.Nature attributeNature = determineAttributeNature( annotations, referencedEntityType ); String accessTypeString = accessType.toString().toLowerCase(); switch ( attributeNature ) { case BASIC: { @@ -570,39 +570,38 @@ public class ConfiguredClass { * * @return an instance of the {@code AttributeType} enum */ - private AttributeNature determineAttributeNature(Map> annotations, - Class referencedCollectionType) { - EnumMap discoveredAttributeTypes = - new EnumMap( AttributeNature.class ); + private MappedAttribute.Nature determineAttributeNature(Map> annotations, Class referencedCollectionType) { + EnumMap discoveredAttributeTypes = + new EnumMap( MappedAttribute.Nature.class ); AnnotationInstance oneToOne = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ONE_TO_ONE ); if ( oneToOne != null ) { - discoveredAttributeTypes.put( AttributeNature.ONE_TO_ONE, oneToOne ); + discoveredAttributeTypes.put( MappedAttribute.Nature.ONE_TO_ONE, oneToOne ); } AnnotationInstance oneToMany = JandexHelper.getSingleAnnotation( annotations, JPADotNames.ONE_TO_MANY ); if ( oneToMany != null ) { - discoveredAttributeTypes.put( AttributeNature.ONE_TO_MANY, oneToMany ); + discoveredAttributeTypes.put( MappedAttribute.Nature.ONE_TO_MANY, oneToMany ); } AnnotationInstance manyToOne = JandexHelper.getSingleAnnotation( annotations, JPADotNames.MANY_TO_ONE ); if ( manyToOne != null ) { - discoveredAttributeTypes.put( AttributeNature.MANY_TO_ONE, manyToOne ); + discoveredAttributeTypes.put( MappedAttribute.Nature.MANY_TO_ONE, manyToOne ); } AnnotationInstance manyToMany = JandexHelper.getSingleAnnotation( annotations, JPADotNames.MANY_TO_MANY ); if ( manyToMany != null ) { - discoveredAttributeTypes.put( AttributeNature.MANY_TO_MANY, manyToMany ); + discoveredAttributeTypes.put( MappedAttribute.Nature.MANY_TO_MANY, manyToMany ); } AnnotationInstance embedded = JandexHelper.getSingleAnnotation( annotations, JPADotNames.EMBEDDED ); if ( embedded != null ) { - discoveredAttributeTypes.put( AttributeNature.EMBEDDED, embedded ); + discoveredAttributeTypes.put( MappedAttribute.Nature.EMBEDDED, embedded ); } AnnotationInstance embeddedId = JandexHelper.getSingleAnnotation( annotations, JPADotNames.EMBEDDED_ID ); if ( embeddedId != null ) { - discoveredAttributeTypes.put( AttributeNature.EMBEDDED_ID, embeddedId ); + discoveredAttributeTypes.put( MappedAttribute.Nature.EMBEDDED_ID, embeddedId ); } AnnotationInstance elementCollection = JandexHelper.getSingleAnnotation( @@ -616,19 +615,17 @@ public class ConfiguredClass { ) ); if ( classInfo.annotations().get( JPADotNames.EMBEDDABLE ) != null ) { - discoveredAttributeTypes.put( AttributeNature.ELEMENT_COLLECTION_EMBEDDABLE, elementCollection ); + discoveredAttributeTypes.put( MappedAttribute.Nature.ELEMENT_COLLECTION_EMBEDDABLE, elementCollection ); } else { - discoveredAttributeTypes.put( AttributeNature.ELEMENT_COLLECTION_BASIC, elementCollection ); + discoveredAttributeTypes.put( MappedAttribute.Nature.ELEMENT_COLLECTION_BASIC, elementCollection ); } - - } int size = discoveredAttributeTypes.size(); switch ( size ) { case 0: - return AttributeNature.BASIC; + return MappedAttribute.Nature.BASIC; case 1: return discoveredAttributeTypes.keySet().iterator().next(); default: diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableHierarchy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableHierarchy.java index dfb03df010..ad27f06976 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableHierarchy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableHierarchy.java @@ -26,16 +26,13 @@ package org.hibernate.metamodel.internal.source.annotations.entity; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.Map; import javax.persistence.AccessType; -import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.hibernate.AssertionFailure; import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext; -import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityBindingContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityBindingContext.java index db821dc403..a9eac79103 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityBindingContext.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/entity/EntityBindingContext.java @@ -33,25 +33,24 @@ import com.fasterxml.classmate.ResolvedType; import com.fasterxml.classmate.ResolvedTypeWithMembers; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; -import org.jboss.jandex.Index; import org.jboss.jandex.IndexView; import org.hibernate.cfg.NamingStrategy; +import org.hibernate.internal.util.ValueHolder; import org.hibernate.jaxb.spi.Origin; import org.hibernate.jaxb.spi.SourceType; -import org.hibernate.internal.util.ValueHolder; +import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext; import org.hibernate.metamodel.internal.source.annotations.IdentifierGeneratorSourceContainer; import org.hibernate.metamodel.internal.source.annotations.util.HibernateDotNames; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; +import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.binding.IdGenerator; import org.hibernate.metamodel.spi.domain.Type; import org.hibernate.metamodel.spi.source.IdentifierGeneratorSource; import org.hibernate.metamodel.spi.source.LocalBindingContext; import org.hibernate.metamodel.spi.source.MappingDefaults; import org.hibernate.metamodel.spi.source.MappingException; -import org.hibernate.metamodel.spi.MetadataImplementor; -import org.hibernate.metamodel.internal.source.annotations.AnnotationBindingContext; import org.hibernate.service.ServiceRegistry; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/IdGeneratorProcessor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/IdGeneratorProcessor.java index c491502799..5ddccff10e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/IdGeneratorProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/IdGeneratorProcessor.java @@ -23,14 +23,13 @@ */ package org.hibernate.metamodel.internal.source.annotations.global; -import javax.persistence.GenerationType; -import javax.persistence.SequenceGenerator; import java.util.Collection; import java.util.HashMap; import java.util.Map; +import javax.persistence.GenerationType; +import javax.persistence.SequenceGenerator; import org.jboss.jandex.AnnotationInstance; - import org.jboss.logging.Logger; import org.hibernate.annotations.GenericGenerator; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/QueryProcessor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/QueryProcessor.java index 2573f72e09..41c63ff364 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/QueryProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/QueryProcessor.java @@ -23,16 +23,15 @@ */ package org.hibernate.metamodel.internal.source.annotations.global; +import java.util.Collection; +import java.util.HashMap; import javax.persistence.NamedNativeQueries; import javax.persistence.NamedNativeQuery; import javax.persistence.NamedQueries; import javax.persistence.NamedQuery; -import java.util.Collection; -import java.util.HashMap; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationValue; - import org.jboss.logging.Logger; import org.hibernate.AnnotationException; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/SqlResultSetProcessor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/SqlResultSetProcessor.java index ee56ab0a72..ba9c1f5dc3 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/SqlResultSetProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/SqlResultSetProcessor.java @@ -33,7 +33,6 @@ import java.util.Map; import java.util.Set; import org.jboss.jandex.AnnotationInstance; - import org.jboss.logging.Logger; import org.hibernate.LockMode; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/TableProcessor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/TableProcessor.java index e96dddd95c..f647ec5527 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/TableProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/global/TableProcessor.java @@ -26,7 +26,6 @@ package org.hibernate.metamodel.internal.source.annotations.global; import java.util.Collection; import org.jboss.jandex.AnnotationInstance; - import org.jboss.logging.Logger; import org.hibernate.AnnotationException; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java index fa248d355b..0f7cbb1705 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EntityHierarchyBuilder.java @@ -23,7 +23,6 @@ */ package org.hibernate.metamodel.internal.source.annotations.util; -import javax.persistence.AccessType; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -31,6 +30,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import javax.persistence.AccessType; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EnumConversionHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EnumConversionHelper.java index 1b4400a1d5..9ef85b8e39 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EnumConversionHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/EnumConversionHelper.java @@ -23,7 +23,6 @@ */ package org.hibernate.metamodel.internal.source.annotations.util; -import java.util.Collections; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; @@ -35,7 +34,9 @@ import org.hibernate.engine.FetchStyle; import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.engine.spi.CascadeStyles; import org.hibernate.id.MultipleHiLoPerTableGenerator; +import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.metamodel.internal.source.annotations.entity.EntityBindingContext; /** * Helper class which converts between different enum types. @@ -128,9 +129,14 @@ public class EnumConversionHelper { } } - public static Set cascadeTypeToCascadeStyleSet(Set cascadeTypes) { + public static Set cascadeTypeToCascadeStyleSet(Set cascadeTypes, EntityBindingContext context) { if ( CollectionHelper.isEmpty( cascadeTypes ) ) { - return Collections.emptySet(); + final Set cascadeStyles = new HashSet(); + String cascades = context.getMappingDefaults().getCascadeStyle(); + for ( String cascade : StringHelper.split( ",", cascades ) ) { + cascadeStyles.add( CascadeStyles.getCascadeStyle( cascade ) ); + } + return cascadeStyles; } Set cascadeStyleSet = new HashSet(); for ( CascadeType cascadeType : cascadeTypes ) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/HibernateDotNames.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/HibernateDotNames.java index 014cee65a8..f770d60081 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/HibernateDotNames.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/util/HibernateDotNames.java @@ -129,11 +129,11 @@ public interface HibernateDotNames { DotName FETCH_PROFILE = DotName.createSimple( FetchProfile.class.getName() ); DotName FETCH_PROFILES = DotName.createSimple( FetchProfiles.class.getName() ); DotName FILTER = DotName.createSimple( Filter.class.getName() ); + DotName FILTERS = DotName.createSimple( Filters.class.getName() ); DotName FILTER_DEF = DotName.createSimple( FilterDef.class.getName() ); DotName FILTER_DEFS = DotName.createSimple( FilterDefs.class.getName() ); DotName FILTER_JOIN_TABLE = DotName.createSimple( FilterJoinTable.class.getName() ); DotName FILTER_JOIN_TABLES = DotName.createSimple( FilterJoinTables.class.getName() ); - DotName FILTERS = DotName.createSimple( Filters.class.getName() ); DotName FOREIGN_KEY = DotName.createSimple( ForeignKey.class.getName() ); DotName FORMULA = DotName.createSimple( Formula.class.getName() ); DotName GENERATED = DotName.createSimple( Generated.class.getName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AbstractMocker.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AbstractMocker.java index c183a4903e..9ed336af1e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AbstractMocker.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AbstractMocker.java @@ -31,9 +31,9 @@ import org.jboss.jandex.AnnotationTarget; import org.jboss.jandex.AnnotationValue; import org.jboss.jandex.DotName; +import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.jaxb.spi.orm.JaxbAccessType; import org.hibernate.jaxb.spi.orm.JaxbUniqueConstraint; -import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AccessHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AccessHelper.java index 4916818062..4f41e589bd 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AccessHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AccessHelper.java @@ -36,8 +36,8 @@ import org.jboss.logging.Logger; import org.hibernate.AssertionFailure; import org.hibernate.MappingException; import org.hibernate.internal.CoreMessageLogger; -import org.hibernate.jaxb.spi.orm.JaxbAccessType; import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.jaxb.spi.orm.JaxbAccessType; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; import org.hibernate.metamodel.internal.source.annotations.xml.PseudoJpaDotNames; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AnnotationMocker.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AnnotationMocker.java index baa5c25873..d7eb74b37c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AnnotationMocker.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/AnnotationMocker.java @@ -35,6 +35,7 @@ import org.jboss.jandex.AnnotationValue; import org.jboss.jandex.DotName; import org.hibernate.AssertionFailure; +import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.jaxb.spi.orm.JaxbAssociationOverride; import org.hibernate.jaxb.spi.orm.JaxbAttributeOverride; import org.hibernate.jaxb.spi.orm.JaxbCollectionTable; @@ -46,7 +47,6 @@ import org.hibernate.jaxb.spi.orm.JaxbLob; import org.hibernate.jaxb.spi.orm.JaxbOrderColumn; import org.hibernate.jaxb.spi.orm.JaxbPrimaryKeyJoinColumn; import org.hibernate.jaxb.spi.orm.JaxbTemporalType; -import org.hibernate.internal.util.collections.CollectionHelper; /** * @author Strong Liu diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/DefaultConfigurationHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/DefaultConfigurationHelper.java index cfa36a5f1f..5f0ec033e4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/DefaultConfigurationHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/DefaultConfigurationHelper.java @@ -33,9 +33,9 @@ import org.jboss.jandex.DotName; import org.jboss.logging.Logger; import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.StringHelper; import org.hibernate.jaxb.spi.orm.JaxbEntity; import org.hibernate.jaxb.spi.orm.JaxbTable; -import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; import org.hibernate.metamodel.internal.source.annotations.xml.filter.IndexedAnnotationFilter; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMappingsMocker.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMappingsMocker.java index b87d25e62d..d312410f79 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMappingsMocker.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMappingsMocker.java @@ -29,7 +29,6 @@ import java.util.List; import org.jboss.jandex.Index; import org.jboss.jandex.IndexView; - import org.jboss.logging.Logger; import org.hibernate.internal.CoreMessageLogger; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMocker.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMocker.java index 77bffa6fb1..ec56690fa1 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMocker.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/EntityMocker.java @@ -34,6 +34,8 @@ import org.jboss.jandex.AnnotationValue; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.jaxb.spi.orm.JaxbAttributes; import org.hibernate.jaxb.spi.orm.JaxbDiscriminatorColumn; import org.hibernate.jaxb.spi.orm.JaxbEntity; @@ -49,8 +51,6 @@ import org.hibernate.jaxb.spi.orm.JaxbPreRemove; import org.hibernate.jaxb.spi.orm.JaxbPreUpdate; import org.hibernate.jaxb.spi.orm.JaxbSecondaryTable; import org.hibernate.jaxb.spi.orm.JaxbTable; -import org.hibernate.internal.util.StringHelper; -import org.hibernate.internal.util.collections.CollectionHelper; /** * Mock to {@link javax.persistence.Entity @Entity} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotationMocker.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotationMocker.java index 6193deb232..dec416fd77 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotationMocker.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotationMocker.java @@ -31,6 +31,7 @@ import java.util.List; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationValue; +import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.jaxb.spi.orm.JaxbColumnResult; import org.hibernate.jaxb.spi.orm.JaxbEntityResult; import org.hibernate.jaxb.spi.orm.JaxbFieldResult; @@ -40,7 +41,6 @@ import org.hibernate.jaxb.spi.orm.JaxbQueryHint; import org.hibernate.jaxb.spi.orm.JaxbSequenceGenerator; import org.hibernate.jaxb.spi.orm.JaxbSqlResultSetMapping; import org.hibernate.jaxb.spi.orm.JaxbTableGenerator; -import org.hibernate.internal.util.collections.CollectionHelper; /** * @author Strong Liu diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotations.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotations.java index d5dbf95c1f..28ee9a6f2e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotations.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/GlobalAnnotations.java @@ -37,6 +37,8 @@ import org.jboss.jandex.DotName; import org.jboss.logging.Logger; import org.hibernate.internal.CoreMessageLogger; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.jaxb.spi.orm.JaxbAttributes; import org.hibernate.jaxb.spi.orm.JaxbEntity; import org.hibernate.jaxb.spi.orm.JaxbEntityMappings; @@ -46,8 +48,6 @@ import org.hibernate.jaxb.spi.orm.JaxbNamedQuery; import org.hibernate.jaxb.spi.orm.JaxbSequenceGenerator; import org.hibernate.jaxb.spi.orm.JaxbSqlResultSetMapping; import org.hibernate.jaxb.spi.orm.JaxbTableGenerator; -import org.hibernate.internal.util.StringHelper; -import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.metamodel.spi.source.MappingException; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/IndexBuilder.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/IndexBuilder.java index 991d0b4017..cf1416c115 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/IndexBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/IndexBuilder.java @@ -35,7 +35,6 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.Index; import org.jboss.jandex.IndexView; - import org.jboss.logging.Logger; import org.hibernate.AssertionFailure; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/MockHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/MockHelper.java index 36e22f00f5..4fc5e95e4b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/MockHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/MockHelper.java @@ -29,7 +29,6 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Collection; import java.util.List; - import javax.persistence.CascadeType; import org.jboss.jandex.AnnotationInstance; @@ -42,9 +41,9 @@ import org.jboss.jandex.MethodInfo; import org.jboss.jandex.Type; import org.hibernate.HibernateException; -import org.hibernate.jaxb.spi.orm.JaxbCascadeType; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.jaxb.spi.orm.JaxbCascadeType; import org.hibernate.metamodel.internal.source.annotations.util.JPADotNames; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.classloading.spi.ClassLoaderService; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/PropertyMocker.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/PropertyMocker.java index 6ee0177102..65697bad17 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/PropertyMocker.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/annotations/xml/mocker/PropertyMocker.java @@ -33,6 +33,7 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.hibernate.HibernateException; +import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.jaxb.spi.orm.JaxbAccessType; import org.hibernate.jaxb.spi.orm.JaxbEnumType; import org.hibernate.jaxb.spi.orm.JaxbMapKey; @@ -40,7 +41,6 @@ import org.hibernate.jaxb.spi.orm.JaxbMapKeyClass; import org.hibernate.jaxb.spi.orm.JaxbMapKeyColumn; import org.hibernate.jaxb.spi.orm.JaxbMapKeyJoinColumn; import org.hibernate.jaxb.spi.orm.JaxbTemporalType; -import org.hibernate.internal.util.collections.CollectionHelper; /** * @author Strong Liu diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractComponentAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractComponentAttributeSourceImpl.java index 052c5aa49f..3ec3a04262 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractComponentAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractComponentAttributeSourceImpl.java @@ -26,6 +26,7 @@ package org.hibernate.metamodel.internal.source.hbm; import java.util.List; import org.hibernate.cfg.NotYetImplementedException; +import org.hibernate.internal.util.ValueHolder; import org.hibernate.jaxb.spi.hbm.ComponentSourceElement; import org.hibernate.jaxb.spi.hbm.JaxbAnyElement; import org.hibernate.jaxb.spi.hbm.JaxbArrayElement; @@ -41,7 +42,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbOneToOneElement; import org.hibernate.jaxb.spi.hbm.JaxbPrimitiveArrayElement; import org.hibernate.jaxb.spi.hbm.JaxbPropertyElement; import org.hibernate.jaxb.spi.hbm.JaxbSetElement; -import org.hibernate.internal.util.ValueHolder; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.AttributeSource; import org.hibernate.metamodel.spi.source.AttributeSourceContainer; @@ -49,7 +49,6 @@ import org.hibernate.metamodel.spi.source.ComponentAttributeSource; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.LocalBindingContext; import org.hibernate.metamodel.spi.source.MetaAttributeSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.SingularAttributeSource; /** @@ -194,8 +193,8 @@ public abstract class AbstractComponentAttributeSourceImpl extends AbstractHbmSo } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.COMPONENT; + public Nature getNature() { + return Nature.COMPONENT; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractEntitySourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractEntitySourceImpl.java index 22fd30e60a..2e38a4226b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractEntitySourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractEntitySourceImpl.java @@ -30,6 +30,7 @@ import java.util.List; import java.util.Set; import org.hibernate.EntityMode; +import org.hibernate.internal.util.StringHelper; import org.hibernate.jaxb.spi.Origin; import org.hibernate.jaxb.spi.hbm.EntityElement; import org.hibernate.jaxb.spi.hbm.JaxbAnyElement; @@ -47,7 +48,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbSetElement; import org.hibernate.jaxb.spi.hbm.JaxbSynchronizeElement; import org.hibernate.jaxb.spi.hbm.JaxbTuplizerElement; import org.hibernate.jaxb.spi.hbm.JoinElementSource; -import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.spi.binding.CustomSQL; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.AttributeSource; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractHbmSourceNode.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractHbmSourceNode.java index 939478072d..4d559cb14d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractHbmSourceNode.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractHbmSourceNode.java @@ -23,10 +23,10 @@ */ package org.hibernate.metamodel.internal.source.hbm; +import org.hibernate.internal.util.ValueHolder; import org.hibernate.jaxb.spi.JaxbRoot; import org.hibernate.jaxb.spi.Origin; import org.hibernate.jaxb.spi.hbm.JaxbHibernateMapping; -import org.hibernate.internal.util.ValueHolder; import org.hibernate.metamodel.spi.source.MappingException; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java index 54b04da1a8..f5dd219fdb 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/AbstractPluralAttributeSourceImpl.java @@ -30,8 +30,8 @@ import org.hibernate.FetchMode; import org.hibernate.cfg.NotYetImplementedException; import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchTiming; -import org.hibernate.jaxb.spi.hbm.PluralAttributeElement; import org.hibernate.internal.util.StringHelper; +import org.hibernate.jaxb.spi.hbm.PluralAttributeElement; import org.hibernate.metamodel.spi.binding.Caching; import org.hibernate.metamodel.spi.binding.CustomSQL; import org.hibernate.metamodel.spi.source.AttributeSourceContainer; @@ -120,7 +120,7 @@ public abstract class AbstractPluralAttributeSourceImpl } else if ( pluralAttributeElement.getManyToAny() != null ) { throw new NotYetImplementedException( "Support for many-to-any not yet implemented" ); -// return PluralAttributeElementNature.MANY_TO_ANY; +// return Nature.MANY_TO_ANY; } else { throw new MappingException( diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BagAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BagAttributeSourceImpl.java index 6e01832572..ff87cc6b21 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BagAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BagAttributeSourceImpl.java @@ -23,11 +23,10 @@ */ package org.hibernate.metamodel.internal.source.hbm; -import org.hibernate.jaxb.spi.hbm.JaxbBagElement; import org.hibernate.internal.util.StringHelper; +import org.hibernate.jaxb.spi.hbm.JaxbBagElement; import org.hibernate.metamodel.spi.source.AttributeSourceContainer; import org.hibernate.metamodel.spi.source.Orderable; -import org.hibernate.metamodel.spi.source.PluralAttributeNature; /** * @author Steve Ebersole @@ -41,8 +40,8 @@ public class BagAttributeSourceImpl extends AbstractPluralAttributeSourceImpl im } @Override - public PluralAttributeNature getPluralAttributeNature() { - return PluralAttributeNature.BAG; + public Nature getNature() { + return Nature.BAG; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BasicPluralAttributeElementSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BasicPluralAttributeElementSourceImpl.java index 3e20c648a2..c562e07c9d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BasicPluralAttributeElementSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/BasicPluralAttributeElementSourceImpl.java @@ -30,7 +30,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbColumnElement; import org.hibernate.jaxb.spi.hbm.JaxbElementElement; import org.hibernate.metamodel.spi.source.BasicPluralAttributeElementSource; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; -import org.hibernate.metamodel.spi.source.PluralAttributeElementNature; import org.hibernate.metamodel.spi.source.RelationalValueSource; /** @@ -110,8 +109,8 @@ public class BasicPluralAttributeElementSourceImpl } @Override - public PluralAttributeElementNature getNature() { - return PluralAttributeElementNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ComponentAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ComponentAttributeSourceImpl.java index 4e66be7f7a..dbaea37a7a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ComponentAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ComponentAttributeSourceImpl.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; import org.hibernate.EntityMode; +import org.hibernate.internal.util.StringHelper; import org.hibernate.jaxb.spi.hbm.JaxbAnyElement; import org.hibernate.jaxb.spi.hbm.JaxbArrayElement; import org.hibernate.jaxb.spi.hbm.JaxbBagElement; @@ -40,7 +41,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbPrimitiveArrayElement; import org.hibernate.jaxb.spi.hbm.JaxbPropertyElement; import org.hibernate.jaxb.spi.hbm.JaxbSetElement; import org.hibernate.jaxb.spi.hbm.JaxbTuplizerElement; -import org.hibernate.internal.util.StringHelper; import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.AttributeSource; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/CompositePluralAttributeElementSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/CompositePluralAttributeElementSourceImpl.java index 20dc66e308..6bf2df5818 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/CompositePluralAttributeElementSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/CompositePluralAttributeElementSourceImpl.java @@ -27,14 +27,13 @@ import java.util.ArrayList; import java.util.List; import org.hibernate.EntityMode; -import org.hibernate.jaxb.spi.hbm.JaxbCompositeElementElement; -import org.hibernate.jaxb.spi.hbm.JaxbTuplizerElement; import org.hibernate.internal.util.StringHelper; import org.hibernate.internal.util.ValueHolder; -import org.hibernate.metamodel.spi.source.LocalBindingContext; +import org.hibernate.jaxb.spi.hbm.JaxbCompositeElementElement; +import org.hibernate.jaxb.spi.hbm.JaxbTuplizerElement; import org.hibernate.metamodel.spi.source.AttributeSource; import org.hibernate.metamodel.spi.source.CompositePluralAttributeElementSource; -import org.hibernate.metamodel.spi.source.PluralAttributeElementNature; +import org.hibernate.metamodel.spi.source.LocalBindingContext; /** * @author Steve Ebersole @@ -53,8 +52,8 @@ public class CompositePluralAttributeElementSourceImpl } @Override - public PluralAttributeElementNature getNature() { - return PluralAttributeElementNature.COMPONENT; + public Nature getNature() { + return Nature.COMPONENT; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/EntityHierarchyImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/EntityHierarchyImpl.java index ab18405f63..fb72bd06ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/EntityHierarchyImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/EntityHierarchyImpl.java @@ -24,9 +24,9 @@ package org.hibernate.metamodel.internal.source.hbm; import org.hibernate.metamodel.spi.binding.InheritanceType; +import org.hibernate.metamodel.spi.source.EntityHierarchy; import org.hibernate.metamodel.spi.source.MappingException; import org.hibernate.metamodel.spi.source.RootEntitySource; -import org.hibernate.metamodel.spi.source.EntityHierarchy; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterSourceImpl.java index 8c9885b5fd..f4db47b79d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/FilterSourceImpl.java @@ -27,9 +27,9 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; +import org.hibernate.internal.util.StringHelper; import org.hibernate.jaxb.spi.hbm.JaxbFilterAliasMappingType; import org.hibernate.jaxb.spi.hbm.JaxbFilterElement; -import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.spi.source.FilterSource; /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/HbmMetadataSourceProcessorImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/HbmMetadataSourceProcessorImpl.java index 89403b6e61..478cfc912c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/HbmMetadataSourceProcessorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/HbmMetadataSourceProcessorImpl.java @@ -29,11 +29,11 @@ import java.util.List; import org.hibernate.jaxb.spi.JaxbRoot; import org.hibernate.jaxb.spi.hbm.JaxbHibernateMapping; import org.hibernate.metamodel.MetadataSources; +import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.MetadataSourceProcessor; import org.hibernate.metamodel.spi.source.EntityHierarchy; import org.hibernate.metamodel.spi.source.FilterDefinitionSource; import org.hibernate.metamodel.spi.source.IdentifierGeneratorSource; -import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.source.TypeDescriptorSource; import static java.util.Collections.emptyList; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java index 7f442df946..e117d85c72 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java @@ -37,6 +37,11 @@ import org.hibernate.cache.spi.access.AccessType; import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.engine.spi.CascadeStyles; import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.ValueHolder; +import org.hibernate.internal.util.collections.CollectionHelper; +import org.hibernate.jaxb.spi.Origin; +import org.hibernate.jaxb.spi.hbm.EntityElement; import org.hibernate.jaxb.spi.hbm.JaxbCacheElement; import org.hibernate.jaxb.spi.hbm.JaxbColumnElement; import org.hibernate.jaxb.spi.hbm.JaxbJoinedSubclassElement; @@ -46,12 +51,7 @@ import org.hibernate.jaxb.spi.hbm.JaxbParamElement; import org.hibernate.jaxb.spi.hbm.JaxbSqlDmlElement; import org.hibernate.jaxb.spi.hbm.JaxbSubclassElement; import org.hibernate.jaxb.spi.hbm.JaxbUnionSubclassElement; -import org.hibernate.internal.util.StringHelper; -import org.hibernate.internal.util.ValueHolder; -import org.hibernate.internal.util.collections.CollectionHelper; -import org.hibernate.jaxb.spi.hbm.EntityElement; import org.hibernate.jaxb.spi.hbm.TableInformationSource; -import org.hibernate.jaxb.spi.Origin; import org.hibernate.metamodel.spi.binding.Caching; import org.hibernate.metamodel.spi.binding.CustomSQL; import org.hibernate.metamodel.spi.binding.InheritanceType; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeIndexSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeIndexSource.java index 09a858cbc8..6920f7d60b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeIndexSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeIndexSource.java @@ -31,7 +31,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbColumnElement; import org.hibernate.jaxb.spi.hbm.JaxbIndexElement; import org.hibernate.jaxb.spi.hbm.JaxbListIndexElement; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; -import org.hibernate.metamodel.spi.source.PluralAttributeIndexNature; import org.hibernate.metamodel.spi.source.PluralAttributeIndexSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; @@ -143,8 +142,8 @@ public class ListAttributeIndexSource extends AbstractHbmSourceNode implements P } @Override - public PluralAttributeIndexNature getNature() { - return PluralAttributeIndexNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeSource.java index 4ebf341ee7..6d1a778a89 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ListAttributeSource.java @@ -27,7 +27,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbListElement; import org.hibernate.jaxb.spi.hbm.JaxbListIndexElement; import org.hibernate.metamodel.spi.source.AttributeSourceContainer; import org.hibernate.metamodel.spi.source.IndexedPluralAttributeSource; -import org.hibernate.metamodel.spi.source.PluralAttributeNature; /** * @@ -67,10 +66,10 @@ public class ListAttributeSource extends AbstractPluralAttributeSourceImpl imple /** * {@inheritDoc} * - * @see org.hibernate.metamodel.spi.source.PluralAttributeSource#getPluralAttributeNature() + * @see org.hibernate.metamodel.spi.source.PluralAttributeSource#getNature() */ @Override - public PluralAttributeNature getPluralAttributeNature() { - return PluralAttributeNature.LIST; + public Nature getNature() { + return Nature.LIST; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToManyPluralAttributeElementSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToManyPluralAttributeElementSourceImpl.java index b450e9c5cb..5dd1677463 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToManyPluralAttributeElementSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToManyPluralAttributeElementSourceImpl.java @@ -28,12 +28,11 @@ import java.util.Collections; import java.util.List; import org.hibernate.engine.spi.CascadeStyle; +import org.hibernate.internal.util.StringHelper; import org.hibernate.jaxb.spi.hbm.JaxbColumnElement; import org.hibernate.jaxb.spi.hbm.JaxbManyToManyElement; import org.hibernate.jaxb.spi.hbm.PluralAttributeElement; -import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.spi.source.ManyToManyPluralAttributeElementSource; -import org.hibernate.metamodel.spi.source.PluralAttributeElementNature; import org.hibernate.metamodel.spi.source.RelationalValueSource; /** @@ -92,8 +91,8 @@ public class ManyToManyPluralAttributeElementSourceImpl } @Override - public PluralAttributeElementNature getNature() { - return PluralAttributeElementNature.MANY_TO_MANY; + public Nature getNature() { + return Nature.MANY_TO_MANY; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToOneAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToOneAttributeSourceImpl.java index d1afcc2bfa..1f26b5e911 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToOneAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/ManyToOneAttributeSourceImpl.java @@ -38,7 +38,6 @@ import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.MappingException; import org.hibernate.metamodel.spi.source.MetaAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.ToOneAttributeSource; /** @@ -224,8 +223,8 @@ class ManyToOneAttributeSourceImpl extends AbstractHbmSourceNode implements ToOn } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.MANY_TO_ONE; + public Nature getNature() { + return Nature.MANY_TO_ONE; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeIndexSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeIndexSource.java index f4833e58cd..5fa1112fc3 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeIndexSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeIndexSource.java @@ -30,7 +30,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbColumnElement; import org.hibernate.jaxb.spi.hbm.JaxbIndexElement; import org.hibernate.jaxb.spi.hbm.JaxbMapKeyElement; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; -import org.hibernate.metamodel.spi.source.PluralAttributeIndexNature; import org.hibernate.metamodel.spi.source.PluralAttributeIndexSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; @@ -38,7 +37,7 @@ import org.hibernate.metamodel.spi.source.RelationalValueSource; * */ public class MapAttributeIndexSource extends AbstractHbmSourceNode implements PluralAttributeIndexSource { - private final PluralAttributeIndexNature nature; + private final Nature nature; private final List valueSources; private final ExplicitHibernateTypeSource typeSource; @@ -98,7 +97,7 @@ public class MapAttributeIndexSource extends AbstractHbmSourceNode implements Pl : java.util.Collections.emptyMap(); } }; - this.nature = PluralAttributeIndexNature.BASIC; + this.nature = Nature.BASIC; } public MapAttributeIndexSource(MappingDocument sourceMappingDocument, final JaxbIndexElement indexElement) { @@ -140,7 +139,7 @@ public class MapAttributeIndexSource extends AbstractHbmSourceNode implements Pl } }; - this.nature = PluralAttributeIndexNature.BASIC; + this.nature = Nature.BASIC; } @Override @@ -159,7 +158,7 @@ public class MapAttributeIndexSource extends AbstractHbmSourceNode implements Pl } @Override - public PluralAttributeIndexNature getNature() { + public Nature getNature() { return nature; } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeSource.java index 9865e34210..96d82e096b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MapAttributeSource.java @@ -29,7 +29,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbMapElement; import org.hibernate.jaxb.spi.hbm.JaxbMapKeyElement; import org.hibernate.metamodel.spi.source.AttributeSourceContainer; import org.hibernate.metamodel.spi.source.IndexedPluralAttributeSource; -import org.hibernate.metamodel.spi.source.PluralAttributeNature; /** * @@ -75,10 +74,10 @@ public class MapAttributeSource extends AbstractPluralAttributeSourceImpl implem /** * {@inheritDoc} * - * @see org.hibernate.metamodel.spi.source.PluralAttributeSource#getPluralAttributeNature() + * @see org.hibernate.metamodel.spi.source.PluralAttributeSource#getNature() */ @Override - public PluralAttributeNature getPluralAttributeNature() { - return PluralAttributeNature.MAP; + public Nature getNature() { + return Nature.MAP; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MappingDocument.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MappingDocument.java index d6d3f6f305..99dffb5f3d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MappingDocument.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/MappingDocument.java @@ -26,12 +26,12 @@ package org.hibernate.metamodel.internal.source.hbm; import java.util.List; import org.hibernate.cfg.NamingStrategy; +import org.hibernate.internal.util.ValueHolder; import org.hibernate.jaxb.spi.JaxbRoot; import org.hibernate.jaxb.spi.Origin; import org.hibernate.jaxb.spi.hbm.EntityElement; import org.hibernate.jaxb.spi.hbm.JaxbFetchProfileElement; import org.hibernate.jaxb.spi.hbm.JaxbHibernateMapping; -import org.hibernate.internal.util.ValueHolder; import org.hibernate.metamodel.internal.source.OverriddenMappingDefaults; import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.domain.Type; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/OneToManyPluralAttributeElementSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/OneToManyPluralAttributeElementSourceImpl.java index 250466ca4e..66c2b9a591 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/OneToManyPluralAttributeElementSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/OneToManyPluralAttributeElementSourceImpl.java @@ -24,11 +24,10 @@ package org.hibernate.metamodel.internal.source.hbm; import org.hibernate.engine.spi.CascadeStyle; +import org.hibernate.internal.util.StringHelper; import org.hibernate.jaxb.spi.hbm.JaxbOneToManyElement; import org.hibernate.jaxb.spi.hbm.PluralAttributeElement; -import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.spi.source.OneToManyPluralAttributeElementSource; -import org.hibernate.metamodel.spi.source.PluralAttributeElementNature; /** * @author Steve Ebersole @@ -49,8 +48,8 @@ public class OneToManyPluralAttributeElementSourceImpl } @Override - public PluralAttributeElementNature getNature() { - return PluralAttributeElementNature.ONE_TO_MANY; + public Nature getNature() { + return Nature.ONE_TO_MANY; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/PropertyAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/PropertyAttributeSourceImpl.java index f30372b55e..20056d117b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/PropertyAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/PropertyAttributeSourceImpl.java @@ -33,7 +33,6 @@ import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.MetaAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.SingularAttributeSource; /** @@ -152,8 +151,8 @@ class PropertyAttributeSourceImpl extends AbstractHbmSourceNode implements Singu } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java index e142c2de64..52db8e3fed 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/RootEntitySourceImpl.java @@ -31,6 +31,8 @@ import org.hibernate.EntityMode; import org.hibernate.TruthValue; import org.hibernate.engine.OptimisticLockStyle; import org.hibernate.id.EntityIdentifierNature; +import org.hibernate.internal.util.StringHelper; +import org.hibernate.internal.util.ValueHolder; import org.hibernate.jaxb.spi.hbm.JaxbClassElement; import org.hibernate.jaxb.spi.hbm.JaxbCompositeIdElement; import org.hibernate.jaxb.spi.hbm.JaxbDiscriminatorElement; @@ -38,8 +40,6 @@ import org.hibernate.jaxb.spi.hbm.JaxbKeyManyToOneElement; import org.hibernate.jaxb.spi.hbm.JaxbKeyPropertyElement; import org.hibernate.jaxb.spi.hbm.JaxbMultiTenancyElement; import org.hibernate.jaxb.spi.hbm.JaxbNaturalIdElement; -import org.hibernate.internal.util.StringHelper; -import org.hibernate.internal.util.ValueHolder; import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.spi.binding.Caching; import org.hibernate.metamodel.spi.binding.IdGenerator; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SetAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SetAttributeSourceImpl.java index 4048abe0bc..f24805b73a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SetAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SetAttributeSourceImpl.java @@ -23,11 +23,10 @@ */ package org.hibernate.metamodel.internal.source.hbm; -import org.hibernate.jaxb.spi.hbm.JaxbSetElement; import org.hibernate.internal.util.StringHelper; +import org.hibernate.jaxb.spi.hbm.JaxbSetElement; import org.hibernate.metamodel.spi.source.AttributeSourceContainer; import org.hibernate.metamodel.spi.source.Orderable; -import org.hibernate.metamodel.spi.source.PluralAttributeNature; import org.hibernate.metamodel.spi.source.Sortable; /** @@ -47,8 +46,8 @@ public class SetAttributeSourceImpl extends AbstractPluralAttributeSourceImpl im } @Override - public PluralAttributeNature getPluralAttributeNature() { - return PluralAttributeNature.SET; + public Nature getNature() { + return Nature.SET; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SingularIdentifierAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SingularIdentifierAttributeSourceImpl.java index ac1ee5b3cd..f125c46edb 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SingularIdentifierAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/SingularIdentifierAttributeSourceImpl.java @@ -33,7 +33,6 @@ import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.MetaAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.SingularAttributeSource; /** @@ -137,8 +136,8 @@ class SingularIdentifierAttributeSourceImpl } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/TimestampAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/TimestampAttributeSourceImpl.java index 8d3ed203b3..cfb12f974b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/TimestampAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/TimestampAttributeSourceImpl.java @@ -26,14 +26,13 @@ package org.hibernate.metamodel.internal.source.hbm; import java.util.List; import java.util.Map; -import org.hibernate.jaxb.spi.hbm.JaxbTimestampElement; import org.hibernate.internal.util.ValueHolder; +import org.hibernate.jaxb.spi.hbm.JaxbTimestampElement; import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.MetaAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.VersionAttributeSource; /** @@ -135,8 +134,8 @@ class TimestampAttributeSourceImpl } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/VersionAttributeSourceImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/VersionAttributeSourceImpl.java index 8ad8c8b453..474f61d566 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/VersionAttributeSourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/VersionAttributeSourceImpl.java @@ -26,15 +26,14 @@ package org.hibernate.metamodel.internal.source.hbm; import java.util.List; import java.util.Map; +import org.hibernate.internal.util.ValueHolder; import org.hibernate.jaxb.spi.hbm.JaxbColumnElement; import org.hibernate.jaxb.spi.hbm.JaxbVersionElement; -import org.hibernate.internal.util.ValueHolder; import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.source.ExplicitHibernateTypeSource; import org.hibernate.metamodel.spi.source.MetaAttributeSource; import org.hibernate.metamodel.spi.source.RelationalValueSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.VersionAttributeSource; @@ -146,8 +145,8 @@ class VersionAttributeSourceImpl } @Override - public SingularAttributeNature getNature() { - return SingularAttributeNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/MetadataSourceProcessor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/MetadataSourceProcessor.java index e24b3f3cb8..0fc4fe0963 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/MetadataSourceProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/MetadataSourceProcessor.java @@ -23,7 +23,6 @@ */ package org.hibernate.metamodel.spi; -import org.hibernate.metamodel.spi.binding.IdGenerator; import org.hibernate.metamodel.spi.source.EntityHierarchy; import org.hibernate.metamodel.spi.source.FilterDefinitionSource; import org.hibernate.metamodel.spi.source.IdentifierGeneratorSource; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeAssociationElementBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeAssociationElementBinding.java index 79f5cc41ba..ce330f5b3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeAssociationElementBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeAssociationElementBinding.java @@ -26,9 +26,6 @@ package org.hibernate.metamodel.spi.binding; import java.util.ArrayList; import java.util.List; -import org.hibernate.FetchMode; -import org.hibernate.engine.FetchStyle; -import org.hibernate.engine.FetchTiming; import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.engine.spi.CascadeStyles; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeBinding.java index eb11d84347..e84e8c72a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AbstractPluralAttributeBinding.java @@ -60,7 +60,6 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi private String orderBy; private boolean sorted; private Comparator< ? > comparator; - private String comparatorClassName; private String customLoaderName; private CustomSQL customSqlInsert; @@ -77,7 +76,7 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi protected AbstractPluralAttributeBinding( AttributeBindingContainer container, PluralAttribute attribute, - PluralAttributeElementNature pluralAttributeElementNature, + PluralAttributeElementBinding.Nature pluralAttributeElementNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, @@ -91,10 +90,11 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi ); this.pluralAttributeKeyBinding = new PluralAttributeKeyBinding( this, referencedAttributeBinding ); this.pluralAttributeElementBinding = interpretNature( pluralAttributeElementNature ); + this.referencedPropertyName = referencedAttributeBinding.getAttribute().getName(); } - private AbstractPluralAttributeElementBinding interpretNature(PluralAttributeElementNature pluralAttributeElementNature) { - switch ( pluralAttributeElementNature ) { + private AbstractPluralAttributeElementBinding interpretNature(PluralAttributeElementBinding.Nature nature) { + switch ( nature ) { case BASIC: { return new BasicPluralAttributeElementBinding( this ); } @@ -111,7 +111,7 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi return new ManyToAnyPluralAttributeElementBinding( this ); } default: { - throw new AssertionFailure( "Unknown collection element nature : " + pluralAttributeElementNature ); + throw new AssertionFailure( "Unknown collection element nature : " + nature ); } } } @@ -156,7 +156,7 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi @Override public boolean isAssociation() { - return pluralAttributeElementBinding.getPluralAttributeElementNature().isAssociation(); + return pluralAttributeElementBinding.getNature().isAssociation(); } @Override @@ -297,6 +297,10 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi return sorted; } + public void setSorted(boolean sorted) { + this.sorted = sorted; + } + @Override public Comparator< ? > getComparator() { return comparator; @@ -306,10 +310,6 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi this.comparator = comparator; } - public String getComparatorClassName() { - return comparatorClassName; - } - public void addFilterConfiguration(FilterConfiguration filterConfiguration) { filterConfigurations.add( filterConfiguration ); } @@ -321,12 +321,7 @@ public abstract class AbstractPluralAttributeBinding extends AbstractAttributeBi @Override public FetchMode getFetchMode() { - if ( getFetchStyle() == FetchStyle.JOIN ) { - return FetchMode.JOIN; - } - else { - return FetchMode.SELECT; - } + return getFetchStyle() == FetchStyle.JOIN ? FetchMode.JOIN : FetchMode.SELECT; } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AttributeBindingContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AttributeBindingContainer.java index 3a21aaf9ce..85f932f622 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AttributeBindingContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/AttributeBindingContainer.java @@ -163,7 +163,7 @@ public interface AttributeBindingContainer { */ public BagBinding makeBagAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, @@ -185,7 +185,7 @@ public interface AttributeBindingContainer { */ public ListBinding makeListAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, @@ -208,8 +208,8 @@ public interface AttributeBindingContainer { */ public MapBinding makeMapAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature elementNature, - PluralAttributeIndexNature indexNature, + PluralAttributeElementBinding.Nature elementNature, + PluralAttributeIndexBinding.Nature indexNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, @@ -230,7 +230,7 @@ public interface AttributeBindingContainer { */ public SetBinding makeSetAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BagBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BagBinding.java index 42ed8176a7..e9f78f543b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BagBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BagBinding.java @@ -35,7 +35,7 @@ public class BagBinding extends AbstractPluralAttributeBinding { protected BagBinding( AttributeBindingContainer container, PluralAttribute attribute, - PluralAttributeElementNature pluralAttributeElementNature, + PluralAttributeElementBinding.Nature pluralAttributeElementNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeElementBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeElementBinding.java index b80d5f9cca..fc13c1b8e7 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeElementBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeElementBinding.java @@ -26,7 +26,7 @@ package org.hibernate.metamodel.spi.binding; import java.util.List; /** - * Describes plural attributes of {@link PluralAttributeElementNature#BASIC} elements + * Describes plural attributes of {@link org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding.Nature#BASIC} elements * * @author Steve Ebersole * @author Gail Badner @@ -41,8 +41,8 @@ public class BasicPluralAttributeElementBinding extends AbstractPluralAttributeE } @Override - public PluralAttributeElementNature getPluralAttributeElementNature() { - return PluralAttributeElementNature.BASIC; + public Nature getNature() { + return Nature.BASIC; } public void setRelationalValueBindings(List relationalValueBindings) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeIndexBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeIndexBinding.java index 871912efc9..139bfef043 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeIndexBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/BasicPluralAttributeIndexBinding.java @@ -33,13 +33,13 @@ import org.hibernate.metamodel.spi.relational.Value; public class BasicPluralAttributeIndexBinding implements PluralAttributeIndexBinding { private final IndexedPluralAttributeBinding pluralAttributeBinding; - private final PluralAttributeIndexNature pluralAttributeIndexNature; + private final Nature pluralAttributeIndexNature; private final HibernateTypeDescriptor hibernateTypeDescriptor = new HibernateTypeDescriptor(); private Value value; public BasicPluralAttributeIndexBinding( IndexedPluralAttributeBinding pluralAttributeBinding, - PluralAttributeIndexNature pluralAttributeIndexNature) { + Nature pluralAttributeIndexNature) { this.pluralAttributeBinding = pluralAttributeBinding; this.pluralAttributeIndexNature = pluralAttributeIndexNature; } @@ -55,7 +55,7 @@ public class BasicPluralAttributeIndexBinding implements PluralAttributeIndexBin } @Override - public IndexedPluralAttributeBinding getPluralAttributeBinding() { + public IndexedPluralAttributeBinding getNature() { return pluralAttributeBinding; } @@ -65,11 +65,11 @@ public class BasicPluralAttributeIndexBinding implements PluralAttributeIndexBin @Override public Type getPluralAttributeIndexType() { - return ( (IndexedPluralAttribute) getPluralAttributeBinding().getAttribute() ).getIndexType(); + return ( (IndexedPluralAttribute) getNature().getAttribute() ).getIndexType(); } @Override - public PluralAttributeIndexNature getPluralAttributeIndexNature() { + public Nature getPluralAttributeIndexNature() { return pluralAttributeIndexNature; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositeAttributeBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositeAttributeBinding.java index 22d59a9830..5fb6967f4a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositeAttributeBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositeAttributeBinding.java @@ -37,7 +37,6 @@ import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.spi.domain.AttributeContainer; import org.hibernate.metamodel.spi.domain.Composite; import org.hibernate.metamodel.spi.domain.PluralAttribute; -import org.hibernate.metamodel.spi.domain.PluralAttributeNature; import org.hibernate.metamodel.spi.domain.SingularAttribute; import org.hibernate.metamodel.spi.source.MetaAttributeContext; @@ -305,12 +304,12 @@ public class CompositeAttributeBinding @Override public BagBinding makeBagAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.BAG ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.BAG ); final BagBinding binding = new BagBinding( this, attribute, @@ -327,13 +326,13 @@ public class CompositeAttributeBinding @Override public ListBinding makeListAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext, int base) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.LIST ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.LIST ); final ListBinding binding = new ListBinding( this, attribute, @@ -350,13 +349,13 @@ public class CompositeAttributeBinding @Override public MapBinding makeMapAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature elementNature, - PluralAttributeIndexNature indexNature, + PluralAttributeElementBinding.Nature elementNature, + PluralAttributeIndexBinding.Nature indexNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.MAP ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.MAP ); final MapBinding binding = new MapBinding( this, attribute, @@ -373,12 +372,12 @@ public class CompositeAttributeBinding @Override public SetBinding makeSetAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.SET ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.SET ); final SetBinding binding = new SetBinding( this, attribute, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositePluralAttributeElementBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositePluralAttributeElementBinding.java index 261b38a1d3..5f131b122a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositePluralAttributeElementBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/CompositePluralAttributeElementBinding.java @@ -24,7 +24,7 @@ package org.hibernate.metamodel.spi.binding; /** - * Describes plural attributes of {@link PluralAttributeElementNature#COMPOSITE} elements + * Describes plural attributes of {@link org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding.Nature#COMPOSITE} elements * * @author Steve Ebersole * @author Gail Badner @@ -35,7 +35,7 @@ public class CompositePluralAttributeElementBinding extends AbstractPluralAttrib } @Override - public PluralAttributeElementNature getPluralAttributeElementNature() { - return PluralAttributeElementNature.COMPOSITE; + public Nature getNature() { + return Nature.COMPOSITE; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java index 060a93de56..f2495e902e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityBinding.java @@ -39,7 +39,6 @@ import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.spi.domain.AttributeContainer; import org.hibernate.metamodel.spi.domain.Entity; import org.hibernate.metamodel.spi.domain.PluralAttribute; -import org.hibernate.metamodel.spi.domain.PluralAttributeNature; import org.hibernate.metamodel.spi.domain.SingularAttribute; import org.hibernate.metamodel.spi.relational.TableSpecification; import org.hibernate.metamodel.spi.source.JpaCallbackSource; @@ -599,12 +598,12 @@ public class EntityBinding implements AttributeBindingContainer { @Override public BagBinding makeBagAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.BAG ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.BAG ); final BagBinding binding = new BagBinding( this, attribute, @@ -621,13 +620,13 @@ public class EntityBinding implements AttributeBindingContainer { @Override public ListBinding makeListAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext, int base) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.LIST ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.LIST ); final ListBinding binding = new ListBinding( this, attribute, @@ -645,13 +644,13 @@ public class EntityBinding implements AttributeBindingContainer { @Override public MapBinding makeMapAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature elementNature, - PluralAttributeIndexNature indexNature, + PluralAttributeElementBinding.Nature elementNature, + PluralAttributeIndexBinding.Nature indexNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.MAP ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.MAP ); final MapBinding binding = new MapBinding( this, attribute, @@ -669,12 +668,12 @@ public class EntityBinding implements AttributeBindingContainer { @Override public SetBinding makeSetAttributeBinding( PluralAttribute attribute, - PluralAttributeElementNature nature, + PluralAttributeElementBinding.Nature nature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, MetaAttributeContext metaAttributeContext) { - Helper.checkPluralAttributeNature( attribute, PluralAttributeNature.SET ); + Helper.checkPluralAttributeNature( attribute, PluralAttribute.Nature.SET ); final SetBinding binding = new SetBinding( this, attribute, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityVersion.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityVersion.java index afd8203fbd..ccd484a324 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityVersion.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/EntityVersion.java @@ -23,8 +23,6 @@ */ package org.hibernate.metamodel.spi.binding; -import org.hibernate.metamodel.spi.source.EntityHierarchy; - /** * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/Helper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/Helper.java index d7843e4a1f..7440aacd90 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/Helper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/Helper.java @@ -25,7 +25,6 @@ package org.hibernate.metamodel.spi.binding; import org.hibernate.AssertionFailure; import org.hibernate.metamodel.spi.domain.PluralAttribute; -import org.hibernate.metamodel.spi.domain.PluralAttributeNature; /** * Helper utilities specific to the binding package. @@ -33,7 +32,7 @@ import org.hibernate.metamodel.spi.domain.PluralAttributeNature; * @author Steve Ebersole */ public class Helper { - public static void checkPluralAttributeNature(PluralAttribute attribute, PluralAttributeNature expected) { + public static void checkPluralAttributeNature(PluralAttribute attribute, PluralAttribute.Nature expected) { if ( attribute.getNature() != expected ) { throw new AssertionFailure( String.format( diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ListBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ListBinding.java index b633d35954..842649b5f8 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ListBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ListBinding.java @@ -37,7 +37,7 @@ public class ListBinding extends AbstractPluralAttributeBinding implements Index public ListBinding( AttributeBindingContainer container, PluralAttribute attribute, - PluralAttributeElementNature pluralAttributeElementNature, + PluralAttributeElementBinding.Nature pluralAttributeElementNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, @@ -51,7 +51,7 @@ public class ListBinding extends AbstractPluralAttributeBinding implements Index propertyAccessorName, includedInOptimisticLocking, metaAttributeContext ); - pluralAttributeIndexBinding = new BasicPluralAttributeIndexBinding( this, PluralAttributeIndexNature.BASIC ); + pluralAttributeIndexBinding = new BasicPluralAttributeIndexBinding( this, PluralAttributeIndexBinding.Nature.BASIC ); this.base = base; } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToAnyPluralAttributeElementBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToAnyPluralAttributeElementBinding.java index 8d18d4c1b6..d380756a69 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToAnyPluralAttributeElementBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToAnyPluralAttributeElementBinding.java @@ -24,7 +24,7 @@ package org.hibernate.metamodel.spi.binding; /** - * Describes plural attributes of {@link PluralAttributeElementNature#MANY_TO_ANY} elements + * Describes plural attributes of {@link org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding.Nature#MANY_TO_ANY} elements * * @author Steve Ebersole * @author Gail Badner @@ -35,7 +35,7 @@ public class ManyToAnyPluralAttributeElementBinding extends AbstractPluralAttrib } @Override - public PluralAttributeElementNature getPluralAttributeElementNature() { - return PluralAttributeElementNature.MANY_TO_ANY; + public Nature getNature() { + return Nature.MANY_TO_ANY; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToManyPluralAttributeElementBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToManyPluralAttributeElementBinding.java index 464af28118..b871dc475c 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToManyPluralAttributeElementBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/ManyToManyPluralAttributeElementBinding.java @@ -25,11 +25,10 @@ package org.hibernate.metamodel.spi.binding; import java.util.HashMap; -import org.hibernate.metamodel.spi.relational.Table; import org.hibernate.metamodel.spi.relational.Value; /** - * Describes plural attributes of {@link PluralAttributeElementNature#MANY_TO_MANY} elements + * Describes plural attributes of {@link org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding.Nature#MANY_TO_MANY} elements * * @author Steve Ebersole * @author Gail Badner @@ -46,8 +45,8 @@ public class ManyToManyPluralAttributeElementBinding extends AbstractPluralAttri } @Override - public PluralAttributeElementNature getPluralAttributeElementNature() { - return PluralAttributeElementNature.MANY_TO_MANY; + public Nature getNature() { + return Nature.MANY_TO_MANY; } public String getManyToManyWhere() { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/MapBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/MapBinding.java index df5d0688be..28c22c35db 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/MapBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/MapBinding.java @@ -36,8 +36,8 @@ public class MapBinding extends AbstractPluralAttributeBinding implements Indexe public MapBinding( AttributeBindingContainer container, PluralAttribute attribute, - PluralAttributeElementNature pluralAttributeElementNature, - PluralAttributeIndexNature pluralAttributeIndexNature, + PluralAttributeElementBinding.Nature pluralAttributeElementNature, + PluralAttributeIndexBinding.Nature pluralAttributeIndexNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/OneToManyPluralAttributeElementBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/OneToManyPluralAttributeElementBinding.java index 4674d55cf1..f775ef97df 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/OneToManyPluralAttributeElementBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/OneToManyPluralAttributeElementBinding.java @@ -24,7 +24,7 @@ package org.hibernate.metamodel.spi.binding; /** - * Describes plural attributes of {@link PluralAttributeElementNature#ONE_TO_MANY} elements + * Describes plural attributes of {@link org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding.Nature#ONE_TO_MANY} elements * * @author Steve Ebersole * @author Gail Badner @@ -35,7 +35,7 @@ public class OneToManyPluralAttributeElementBinding extends AbstractPluralAttrib } @Override - public PluralAttributeElementNature getPluralAttributeElementNature() { - return PluralAttributeElementNature.ONE_TO_MANY; + public Nature getNature() { + return Nature.ONE_TO_MANY; } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementBinding.java index b0add09c89..c70fc590de 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementBinding.java @@ -51,7 +51,7 @@ public interface PluralAttributeElementBinding { * * @return The nature enum. */ - public PluralAttributeElementNature getPluralAttributeElementNature(); + public Nature getNature(); /** * Retrieve the Hibernate type descriptor describing the mapping-typing of the elements. @@ -59,4 +59,47 @@ public interface PluralAttributeElementBinding { * @return The element type descriptor. */ public HibernateTypeDescriptor getHibernateTypeDescriptor(); + + /** + * Describes the nature of plural attribute elements in terms of relational implications. + * + * @author Steve Ebersole + * @author Gail Badner + */ + enum Nature { + /** + * The collection elements are basic, simple values. + */ + BASIC( false ), + /** + * The collection elements are compositions. + */ + COMPOSITE( false ), + /** + * The collection elements represent entity's in a one-to-many association. + */ + ONE_TO_MANY, + /** + * The collection elements represent entity's in a many-to-many association. + */ + MANY_TO_MANY, + /** + * The collection elements represent entity's in a multi-valued ANY mapping. + */ + MANY_TO_ANY; + + private final boolean isAssociation; + + private Nature() { + this( true ); + } + + private Nature(boolean association) { + this.isAssociation = association; + } + + public boolean isAssociation() { + return isAssociation; + } + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementNature.java deleted file mode 100644 index 4eeb0c6dba..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeElementNature.java +++ /dev/null @@ -1,67 +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.spi.binding; - -/** - * Describes the nature of plural attribute elements in terms of relational implications. - * - * @author Steve Ebersole - * @author Gail Badner - */ -public enum PluralAttributeElementNature { - /** - * The collection elements are basic, simple values. - */ - BASIC( false ), - /** - * The collection elements are compositions. - */ - COMPOSITE( false ), - /** - * The collection elements represent entity's in a one-to-many association. - */ - ONE_TO_MANY, - /** - * The collection elements represent entity's in a many-to-many association. - */ - MANY_TO_MANY, - /** - * The collection elements represent entity's in a multi-valued ANY mapping. - */ - MANY_TO_ANY; - - private final boolean isAssociation; - - private PluralAttributeElementNature() { - this( true ); - } - - private PluralAttributeElementNature(boolean association) { - this.isAssociation = association; - } - - public boolean isAssociation() { - return isAssociation; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexBinding.java index 25dbf27d9d..3c75767dda 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexBinding.java @@ -30,13 +30,37 @@ import org.hibernate.metamodel.spi.relational.Value; * @author Steve Ebersole */ public interface PluralAttributeIndexBinding { - IndexedPluralAttributeBinding getPluralAttributeBinding(); + IndexedPluralAttributeBinding getNature(); - PluralAttributeIndexNature getPluralAttributeIndexNature(); + Nature getPluralAttributeIndexNature(); Value getIndexRelationalValue(); HibernateTypeDescriptor getHibernateTypeDescriptor(); Type getPluralAttributeIndexType(); + + /** + * Describes the nature of plural attribute indexes in terms of relational implications. + * + * @author Steve Ebersole + */ + enum Nature { + /** + * The collection indexes are basic, simple values. This is the only valid nature for lists + */ + BASIC, + /** + * The map key is a composite + */ + COMPOSITE, + /** + * The map key is an association identified by a column(s) on the collection table. + */ + MANY_TO_MANY, + /** + * The map key is represented by a Hibernate ANY mapping + */ + MANY_TO_ANY + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexNature.java deleted file mode 100644 index b0f09153b4..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeIndexNature.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2012, 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.spi.binding; - -/** - * Describes the nature of plural attribute indexes in terms of relational implications. - * - * @author Steve Ebersole - */ -public enum PluralAttributeIndexNature { - /** - * The collection indexes are basic, simple values. This is the only valid nature for lists - */ - BASIC, - /** - * The map key is a composite - */ - COMPOSITE, - /** - * The map key is an association identified by a column(s) on the collection table. - */ - MANY_TO_MANY, - /** - * The map key is represented by a Hibernate ANY mapping - */ - MANY_TO_ANY -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeKeyBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeKeyBinding.java index 565645e00b..d56b9337f6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeKeyBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/PluralAttributeKeyBinding.java @@ -24,7 +24,6 @@ package org.hibernate.metamodel.spi.binding; import org.hibernate.AssertionFailure; -import org.hibernate.metamodel.spi.domain.Type; import org.hibernate.metamodel.spi.relational.Column; import org.hibernate.metamodel.spi.relational.ForeignKey; import org.hibernate.metamodel.spi.relational.TableSpecification; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/SetBinding.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/SetBinding.java index 39e3c6da7f..1eee42cb76 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/SetBinding.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/SetBinding.java @@ -34,7 +34,7 @@ public class SetBinding extends AbstractPluralAttributeBinding { public SetBinding( AttributeBindingContainer container, PluralAttribute attribute, - PluralAttributeElementNature pluralAttributeElementNature, + PluralAttributeElementBinding.Nature pluralAttributeElementNature, SingularAttributeBinding referencedAttributeBinding, String propertyAccessorName, boolean includedInOptimisticLocking, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/AbstractAttributeContainer.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/AbstractAttributeContainer.java index a8f8f345e9..8bfb6d8857 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/AbstractAttributeContainer.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/AbstractAttributeContainer.java @@ -172,10 +172,10 @@ public abstract class AbstractAttributeContainer implements AttributeContainer, @Override public PluralAttribute createBag(String name) { - return createPluralAttribute( name, PluralAttributeNature.BAG ); + return createPluralAttribute( name, PluralAttribute.Nature.BAG ); } - protected PluralAttribute createPluralAttribute(String name, PluralAttributeNature nature) { + protected PluralAttribute createPluralAttribute(String name, PluralAttribute.Nature nature) { PluralAttribute attribute = nature.isIndexed() ? new IndexedPluralAttributeImpl( this, name, nature ) : new PluralAttributeImpl( this, name, nature ); @@ -185,17 +185,17 @@ public abstract class AbstractAttributeContainer implements AttributeContainer, @Override public PluralAttribute createSet(String name) { - return createPluralAttribute( name, PluralAttributeNature.SET ); + return createPluralAttribute( name, PluralAttribute.Nature.SET ); } @Override public IndexedPluralAttribute createList(String name) { - return (IndexedPluralAttribute) createPluralAttribute( name, PluralAttributeNature.LIST ); + return (IndexedPluralAttribute) createPluralAttribute( name, PluralAttribute.Nature.LIST ); } @Override public IndexedPluralAttribute createMap(String name) { - return (IndexedPluralAttribute) createPluralAttribute( name, PluralAttributeNature.MAP ); + return (IndexedPluralAttribute) createPluralAttribute( name, PluralAttribute.Nature.MAP ); } protected void addAttribute(Attribute attribute) { @@ -258,12 +258,12 @@ public abstract class AbstractAttributeContainer implements AttributeContainer, public static class PluralAttributeImpl implements PluralAttribute { private final AttributeContainer attributeContainer; - private final PluralAttributeNature nature; + private final Nature nature; private final String name; private Type elementType; - public PluralAttributeImpl(AbstractAttributeContainer attributeContainer, String name, PluralAttributeNature nature) { + public PluralAttributeImpl(AbstractAttributeContainer attributeContainer, String name, Nature nature) { this.attributeContainer = attributeContainer; this.name = name; this.nature = nature; @@ -286,7 +286,7 @@ public abstract class AbstractAttributeContainer implements AttributeContainer, } @Override - public PluralAttributeNature getNature() { + public Nature getNature() { return nature; } @@ -314,7 +314,7 @@ public abstract class AbstractAttributeContainer implements AttributeContainer, public static class IndexedPluralAttributeImpl extends PluralAttributeImpl implements IndexedPluralAttribute { private Type indexType; - public IndexedPluralAttributeImpl(AbstractAttributeContainer attributeContainer, String name, PluralAttributeNature nature) { + public IndexedPluralAttributeImpl(AbstractAttributeContainer attributeContainer, String name, Nature nature) { super( attributeContainer, name, nature ); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttribute.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttribute.java index c2118f5830..f6e861bbcb 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttribute.java @@ -23,6 +23,11 @@ */ package org.hibernate.metamodel.spi.domain; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + /** * TODO : javadoc * @@ -30,7 +35,45 @@ package org.hibernate.metamodel.spi.domain; */ public interface PluralAttribute extends Attribute { public String getRole(); - public PluralAttributeNature getNature(); + public Nature getNature(); public Type getElementType(); public void setElementType(Type elementType); + + /** + * Identifies the specific semantic of a plural valued attribute. + * + * @author Steve Ebersole + */ + enum Nature { + ARRAY( "array", Object[].class ), + BAG( "bag", Collection.class ), + IDBAG( "idbag", Collection.class ), + SET( "set", Set.class ), + LIST( "list", List.class ), + MAP( "map", Map.class ); + + private final String name; + private final Class javaContract; + private final boolean indexed; + + Nature(String name, Class javaContract) { + this.name = name; + this.javaContract = javaContract; + this.indexed = Map.class.isAssignableFrom( javaContract ) + || List.class.isAssignableFrom( javaContract ) + || javaContract.isArray(); + } + + public String getName() { + return name; + } + + public Class getJavaContract() { + return javaContract; + } + + public boolean isIndexed() { + return indexed; + } + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttributeNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttributeNature.java deleted file mode 100644 index cc67b18789..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/domain/PluralAttributeNature.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2010, 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.spi.domain; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Identifies the specific semantic of a plural valued attribute. - * - * @author Steve Ebersole - */ -public enum PluralAttributeNature { - ARRAY( "array", Object[].class ), - BAG( "bag", Collection.class ), - IDBAG( "idbag", Collection.class ), - SET( "set", Set.class ), - LIST( "list", List.class ), - MAP( "map", Map.class ); - - private final String name; - private final Class javaContract; - private final boolean indexed; - - PluralAttributeNature(String name, Class javaContract) { - this.name = name; - this.javaContract = javaContract; - this.indexed = Map.class.isAssignableFrom( javaContract ) - || List.class.isAssignableFrom( javaContract ) - || javaContract.isArray(); - } - - public String getName() { - return name; - } - - public Class getJavaContract() { - return javaContract; - } - - public boolean isIndexed() { - return indexed; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java index 22b3ec9151..f0356d18c6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/relational/Index.java @@ -24,7 +24,6 @@ package org.hibernate.metamodel.spi.relational; import org.hibernate.dialect.Dialect; -import org.hibernate.internal.util.StringHelper; /** * Models a SQL INDEX @@ -51,7 +50,7 @@ public class Index extends AbstractConstraint implements Constraint { protected String getGeneratedNamePrefix() { return "IDX"; } - + @Override public String sqlConstraintStringInAlterTable(Dialect dialect) { StringBuilder buf = new StringBuilder( " index (" ); boolean first = true; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java index 5ab891f361..6a205c8aea 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/FetchProfileSource.java @@ -23,8 +23,6 @@ */ package org.hibernate.metamodel.spi.source; -import org.hibernate.annotations.FetchMode; - /** * Defines a source of fetch profile information * diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementNature.java deleted file mode 100644 index 3d8384b196..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementNature.java +++ /dev/null @@ -1,37 +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.spi.source; - -/** - * Describes the nature of the collection elements as declared by the metadata. - * - * @author Steve Ebersole - */ -public enum PluralAttributeElementNature { - BASIC, - COMPONENT, - ONE_TO_MANY, - MANY_TO_MANY, - MANY_TO_ANY -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementSource.java index eb7136842d..fdf88397b8 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeElementSource.java @@ -27,5 +27,18 @@ package org.hibernate.metamodel.spi.source; * @author Steve Ebersole */ public interface PluralAttributeElementSource { - public PluralAttributeElementNature getNature(); + public Nature getNature(); + + /** + * Describes the nature of the collection elements as declared by the metadata. + * + * @author Steve Ebersole + */ + enum Nature { + BASIC, + COMPONENT, + ONE_TO_MANY, + MANY_TO_MANY, + MANY_TO_ANY + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexNature.java deleted file mode 100644 index ffec8940bd..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexNature.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2012, 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.spi.source; - -/** - * Describes the nature of the collection indexes as declared by the sources. - * - * @author Steve Ebersole - * - * @see {@link org.hibernate.metamodel.spi.binding.PluralAttributeIndexNature} - */ -public enum PluralAttributeIndexNature { - BASIC, - COMPOSITE, - MANY_TO_MANY, - MANY_TO_ANY -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexSource.java index 6ac7925a18..58851d01d4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeIndexSource.java @@ -27,6 +27,20 @@ package org.hibernate.metamodel.spi.source; * */ public interface PluralAttributeIndexSource extends RelationalValueSourceContainer { - PluralAttributeIndexNature getNature(); + Nature getNature(); ExplicitHibernateTypeSource explicitHibernateTypeSource(); + + /** + * Describes the nature of the collection indexes as declared by the sources. + * + * @author Steve Ebersole + * + * @see {@link org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding.Nature} + */ + enum Nature { + BASIC, + COMPOSITE, + MANY_TO_MANY, + MANY_TO_ANY + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeNature.java deleted file mode 100644 index 776ffbdab2..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeNature.java +++ /dev/null @@ -1,52 +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.spi.source; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Describes the nature of the collection itself as declared by the metadata. - * - * @author Steve Ebersole - */ -public enum PluralAttributeNature { - BAG( Collection.class ), - ID_BAG( Collection.class ), - SET( Set.class ), - LIST( List.class ), - MAP( Map.class ); - - private final Class reportedJavaType; - - PluralAttributeNature(Class reportedJavaType) { - this.reportedJavaType = reportedJavaType; - } - - public Class reportedJavaType() { - return reportedJavaType; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java index 27fb88cb09..861c48ea81 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/PluralAttributeSource.java @@ -23,6 +23,11 @@ */ package org.hibernate.metamodel.spi.source; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; + import org.hibernate.metamodel.spi.binding.Caching; import org.hibernate.metamodel.spi.binding.CustomSQL; @@ -31,7 +36,7 @@ import org.hibernate.metamodel.spi.binding.CustomSQL; */ public interface PluralAttributeSource extends AttributeSource, FetchableAttributeSource { - public PluralAttributeNature getPluralAttributeNature(); + public Nature getNature(); public PluralAttributeKeySource getKeySource(); @@ -60,4 +65,27 @@ public interface PluralAttributeSource public CustomSQL getCustomSqlDelete(); public CustomSQL getCustomSqlDeleteAll(); + + /** + * Describes the nature of the collection itself as declared by the metadata. + * + * @author Steve Ebersole + */ + enum Nature { + BAG( Collection.class ), + ID_BAG( Collection.class ), + SET( Set.class ), + LIST( List.class ), + MAP( Map.class ); + + private final Class reportedJavaType; + + Nature(Class reportedJavaType) { + this.reportedJavaType = reportedJavaType; + } + + public Class reportedJavaType() { + return reportedJavaType; + } + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeNature.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeNature.java deleted file mode 100644 index a1694d07ce..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeNature.java +++ /dev/null @@ -1,37 +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.spi.source; - -/** - * Describes the understood natures of a singular attribute. - * - * @author Steve Ebersole - */ -public enum SingularAttributeNature { - BASIC, - COMPONENT, - MANY_TO_ONE, - ONE_TO_ONE, - ANY -} diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeSource.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeSource.java index 73d0554617..2c61b208fd 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeSource.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/source/SingularAttributeSource.java @@ -45,7 +45,7 @@ public interface SingularAttributeSource extends AttributeSource, RelationalValu * * @return The attribute type nature */ - public SingularAttributeNature getNature(); + public Nature getNature(); /** * Obtain a description of if/when the attribute value is generated by the database. @@ -68,4 +68,16 @@ public interface SingularAttributeSource extends AttributeSource, RelationalValu */ public SingularAttributeBinding.NaturalIdMutability getNaturalIdMutability(); + /** + * Describes the understood natures of a singular attribute. + * + * @author Steve Ebersole + */ + enum Nature { + BASIC, + COMPONENT, + MANY_TO_ONE, + ONE_TO_ONE, + ANY + } } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java index 6c60a10791..6a7d6370a4 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java @@ -88,7 +88,7 @@ import org.hibernate.metamodel.spi.binding.PluralAttributeAssociationElementBind import org.hibernate.metamodel.spi.binding.PluralAttributeIndexBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeKeyBinding; import org.hibernate.metamodel.spi.binding.RelationalValueBinding; -import org.hibernate.metamodel.spi.domain.PluralAttributeNature; +import org.hibernate.metamodel.spi.domain.PluralAttribute; import org.hibernate.metamodel.spi.relational.Column; import org.hibernate.metamodel.spi.relational.DerivedValue; import org.hibernate.metamodel.spi.relational.TableSpecification; @@ -682,7 +682,7 @@ public abstract class AbstractCollectionPersister this.factory = factory; this.cacheAccessStrategy = cacheAccessStrategy; if ( factory.getSettings().isStructuredCacheEntriesEnabled() ) { - cacheEntryStructure = collection.getAttribute().getNature() == PluralAttributeNature.MAP ? + cacheEntryStructure = collection.getAttribute().getNature() == PluralAttribute.Nature.MAP ? new StructuredMapCacheEntry() : new StructuredCollectionCacheEntry(); } @@ -746,7 +746,7 @@ public abstract class AbstractCollectionPersister null; hasOrphanDelete = - collection.getPluralAttributeElementBinding().getPluralAttributeElementNature().isAssociation() && + collection.getPluralAttributeElementBinding().getNature().isAssociation() && ( ( PluralAttributeAssociationElementBinding ) collection.getPluralAttributeElementBinding() ).isOrphanDeleteEnabled(); int batch = collection.getBatchSize(); @@ -888,7 +888,7 @@ public abstract class AbstractCollectionPersister baseIndex = 0; } - hasIdentifier = collection.getAttribute().getNature() == PluralAttributeNature.IDBAG; + hasIdentifier = collection.getAttribute().getNature() == PluralAttribute.Nature.IDBAG; // TODO: fix this when IdBags are supported. //if ( hasIdentifier ) { //} @@ -959,7 +959,7 @@ public abstract class AbstractCollectionPersister sqlSelectSizeString = generateSelectSizeString( collection.getAttribute().getNature().isIndexed() && - collection.getAttribute().getNature() != PluralAttributeNature.MAP + collection.getAttribute().getNature() != PluralAttribute.Nature.MAP ); sqlDetectRowByIndexString = generateDetectRowByIndexString(); sqlDetectRowByElementString = generateDetectRowByElementString(); @@ -1025,7 +1025,7 @@ public abstract class AbstractCollectionPersister filterHelper = new FilterHelper( collection.getFilterConfigurations(), factory ); // TODO: fix this when ManyToManyPluralAttributeElementBinding is working - //if ( elementBinding.getPluralAttributeElementNature() == PluralAttributeElementNature.MANY_TO_MANY ) { + //if ( elementBinding.getNature() == Nature.MANY_TO_MANY ) { //} //else { manyToManyFilterHelper = new FilterHelper( Collections.emptyList(), factory ); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java index 42576b431a..5be941a4d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java @@ -50,7 +50,7 @@ import org.hibernate.loader.entity.CollectionElementLoader; import org.hibernate.mapping.Collection; import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.binding.AbstractPluralAttributeBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeElementNature; +import org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeKeyBinding; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.relational.ForeignKey; @@ -102,12 +102,12 @@ public class OneToManyPersister extends AbstractCollectionPersister { MetadataImplementor metadata, SessionFactoryImplementor factory) throws MappingException, CacheException { super( collection, cacheAccessStrategy, metadata, factory ); - if ( collection.getPluralAttributeElementBinding().getPluralAttributeElementNature() != - PluralAttributeElementNature.ONE_TO_MANY ) { + if ( collection.getPluralAttributeElementBinding().getNature() != + PluralAttributeElementBinding.Nature.ONE_TO_MANY ) { throw new AssertionError( String.format( "Unexpected plural attribute nature; expected=(%s), actual=(%s)", - PluralAttributeElementNature.ONE_TO_MANY, - collection.getPluralAttributeElementBinding().getPluralAttributeElementNature() + PluralAttributeElementBinding.Nature.ONE_TO_MANY, + collection.getPluralAttributeElementBinding().getNature() ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index b7f7924435..33316c849b 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -37,6 +37,8 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.jboss.logging.Logger; + import org.hibernate.AssertionFailure; import org.hibernate.EntityMode; import org.hibernate.FetchMode; @@ -132,7 +134,6 @@ import org.hibernate.type.EntityType; import org.hibernate.type.Type; import org.hibernate.type.TypeHelper; import org.hibernate.type.VersionType; -import org.jboss.logging.Logger; /** * Basic functionality for persisting an entity via JDBC diff --git a/hibernate-core/src/main/java/org/hibernate/persister/internal/StandardPersisterClassResolver.java b/hibernate-core/src/main/java/org/hibernate/persister/internal/StandardPersisterClassResolver.java index 648f22aa0b..56d34cf383 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/internal/StandardPersisterClassResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/internal/StandardPersisterClassResolver.java @@ -31,9 +31,9 @@ import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.RootClass; import org.hibernate.mapping.SingleTableSubclass; import org.hibernate.mapping.UnionSubclass; -import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeElementNature; import org.hibernate.metamodel.spi.binding.EntityBinding; +import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; +import org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding; import org.hibernate.persister.collection.BasicCollectionPersister; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.OneToManyPersister; @@ -126,7 +126,7 @@ public class StandardPersisterClassResolver implements PersisterClassResolver { @Override public Class getCollectionPersisterClass(PluralAttributeBinding metadata) { - return metadata.getPluralAttributeElementBinding().getPluralAttributeElementNature() == PluralAttributeElementNature.ONE_TO_MANY + return metadata.getPluralAttributeElementBinding().getNature() == PluralAttributeElementBinding.Nature.ONE_TO_MANY ? oneToManyPersister() : basicCollectionPersister(); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java b/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java index f1266a9bee..35bd3846fc 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/spi/PersisterFactory.java @@ -32,9 +32,9 @@ import org.hibernate.engine.spi.Mapping; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.mapping.Collection; import org.hibernate.mapping.PersistentClass; +import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; -import org.hibernate.metamodel.spi.MetadataImplementor; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.service.Service; diff --git a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java index be044a96d7..5d06d3c2ec 100755 --- a/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java @@ -23,8 +23,8 @@ */ package org.hibernate.proxy; -import javax.naming.NamingException; import java.io.Serializable; +import javax.naming.NamingException; import org.jboss.logging.Logger; diff --git a/hibernate-core/src/main/java/org/hibernate/service/ConfigLoader.java b/hibernate-core/src/main/java/org/hibernate/service/ConfigLoader.java index c206e0105c..4fb6fa731c 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/ConfigLoader.java +++ b/hibernate-core/src/main/java/org/hibernate/service/ConfigLoader.java @@ -29,13 +29,13 @@ import java.util.Properties; import org.jboss.logging.Logger; +import org.hibernate.internal.util.ValueHolder; +import org.hibernate.internal.util.config.ConfigurationException; +import org.hibernate.jaxb.internal.JaxbConfigurationProcessor; import org.hibernate.jaxb.spi.Origin; import org.hibernate.jaxb.spi.SourceType; import org.hibernate.jaxb.spi.cfg.JaxbHibernateConfiguration; -import org.hibernate.internal.util.ValueHolder; -import org.hibernate.internal.util.config.ConfigurationException; import org.hibernate.service.classloading.spi.ClassLoaderService; -import org.hibernate.jaxb.internal.JaxbConfigurationProcessor; /** * Loads {@code cfg.xml} files. diff --git a/hibernate-core/src/main/java/org/hibernate/service/ServiceRegistryBuilder.java b/hibernate-core/src/main/java/org/hibernate/service/ServiceRegistryBuilder.java index 03c3e473b3..73157d1cc7 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/ServiceRegistryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/service/ServiceRegistryBuilder.java @@ -33,8 +33,8 @@ import org.hibernate.cfg.Environment; import org.hibernate.integrator.spi.Integrator; import org.hibernate.integrator.spi.IntegratorService; import org.hibernate.integrator.spi.ServiceContributingIntegrator; -import org.hibernate.jaxb.spi.cfg.JaxbHibernateConfiguration; import org.hibernate.internal.util.config.ConfigurationHelper; +import org.hibernate.jaxb.spi.cfg.JaxbHibernateConfiguration; import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.service.internal.ProvidedService; diff --git a/hibernate-core/src/main/java/org/hibernate/service/StandardServiceInitiators.java b/hibernate-core/src/main/java/org/hibernate/service/StandardServiceInitiators.java index 33151568f9..ad5e3bf4c1 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/StandardServiceInitiators.java +++ b/hibernate-core/src/main/java/org/hibernate/service/StandardServiceInitiators.java @@ -27,7 +27,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.hibernate.cache.internal.RegionFactoryInitiator; import org.hibernate.engine.jdbc.batch.internal.BatchBuilderInitiator; import org.hibernate.engine.jdbc.internal.JdbcServicesInitiator; import org.hibernate.engine.transaction.internal.TransactionFactoryInitiator; diff --git a/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/StrategyInstanceResolver.java b/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/StrategyInstanceResolver.java index b894f6c5ba..7c43796094 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/StrategyInstanceResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/service/classloading/spi/StrategyInstanceResolver.java @@ -23,8 +23,6 @@ */ package org.hibernate.service.classloading.spi; -import org.hibernate.HibernateException; - /** * A helper to deal with the common idiom of loading a named strategy implementer. * diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/JdbcEnvironmentInitiator.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/JdbcEnvironmentInitiator.java index 2e67fff90a..dc9277d4b6 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/JdbcEnvironmentInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/JdbcEnvironmentInitiator.java @@ -33,7 +33,6 @@ import org.jboss.logging.Logger; import org.hibernate.MultiTenancyStrategy; import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.config.ConfigurationHelper; -import org.hibernate.service.jdbc.connections.internal.UserSuppliedConnectionException; import org.hibernate.service.jdbc.connections.spi.ConnectionProvider; import org.hibernate.service.jdbc.connections.spi.JdbcConnectionAccess; import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider; diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/NormalizingIdentifierHelperImpl.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/NormalizingIdentifierHelperImpl.java index f398e1f589..d5022d5a7f 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/NormalizingIdentifierHelperImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/internal/NormalizingIdentifierHelperImpl.java @@ -25,10 +25,10 @@ package org.hibernate.service.jdbc.env.internal; import org.jboss.logging.Logger; -import org.hibernate.service.jdbc.env.spi.IdentifierHelper; -import org.hibernate.service.jdbc.env.spi.JdbcEnvironment; import org.hibernate.internal.util.StringHelper; import org.hibernate.metamodel.spi.relational.Identifier; +import org.hibernate.service.jdbc.env.spi.IdentifierHelper; +import org.hibernate.service.jdbc.env.spi.JdbcEnvironment; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/spi/ExtractedDatabaseMetaData.java b/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/spi/ExtractedDatabaseMetaData.java index 61a860df7d..03418f24b7 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/spi/ExtractedDatabaseMetaData.java +++ b/hibernate-core/src/main/java/org/hibernate/service/jdbc/env/spi/ExtractedDatabaseMetaData.java @@ -23,11 +23,6 @@ */ package org.hibernate.service.jdbc.env.spi; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.hibernate.engine.jdbc.internal.TypeInfo; - /** * Information extracted from {@link java.sql.DatabaseMetaData} regarding what the JDBC driver reports as * being supported or not. Obviously {@link java.sql.DatabaseMetaData} reports many things, these are a few in diff --git a/hibernate-core/src/main/java/org/hibernate/service/schema/internal/DatabaseInformationImpl.java b/hibernate-core/src/main/java/org/hibernate/service/schema/internal/DatabaseInformationImpl.java index 4ed59d3b93..8e25de603c 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/schema/internal/DatabaseInformationImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/schema/internal/DatabaseInformationImpl.java @@ -31,11 +31,11 @@ import java.util.Map; import java.util.StringTokenizer; import org.hibernate.TruthValue; -import org.hibernate.service.jdbc.env.spi.IdentifierHelper; -import org.hibernate.service.jdbc.env.spi.JdbcEnvironment; import org.hibernate.metamodel.spi.relational.Identifier; import org.hibernate.metamodel.spi.relational.ObjectName; import org.hibernate.metamodel.spi.relational.Schema; +import org.hibernate.service.jdbc.env.spi.IdentifierHelper; +import org.hibernate.service.jdbc.env.spi.JdbcEnvironment; import org.hibernate.service.schema.spi.ColumnInformation; import org.hibernate.service.schema.spi.DatabaseInformation; import org.hibernate.service.schema.spi.SchemaManagementException; diff --git a/hibernate-core/src/main/java/org/hibernate/service/schema/internal/SchemaValidatorImpl.java b/hibernate-core/src/main/java/org/hibernate/service/schema/internal/SchemaValidatorImpl.java index 1266993c03..40a37c2426 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/schema/internal/SchemaValidatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/schema/internal/SchemaValidatorImpl.java @@ -32,9 +32,9 @@ import org.hibernate.metamodel.spi.relational.Value; import org.hibernate.service.schema.spi.ColumnInformation; import org.hibernate.service.schema.spi.DatabaseInformation; import org.hibernate.service.schema.spi.SchemaManagementException; +import org.hibernate.service.schema.spi.SchemaValidator; import org.hibernate.service.schema.spi.SequenceInformation; import org.hibernate.service.schema.spi.TableInformation; -import org.hibernate.service.schema.spi.SchemaValidator; /** * @author Steve Ebersole diff --git a/hibernate-core/src/main/java/org/hibernate/service/schema/internal/TableInformationImpl.java b/hibernate-core/src/main/java/org/hibernate/service/schema/internal/TableInformationImpl.java index eca0328fdb..da75c5406f 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/schema/internal/TableInformationImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/service/schema/internal/TableInformationImpl.java @@ -31,7 +31,6 @@ import org.hibernate.service.schema.spi.ColumnInformation; import org.hibernate.service.schema.spi.ForeignKeyInformation; import org.hibernate.service.schema.spi.IndexInformation; import org.hibernate.service.schema.spi.TableInformation; -import org.hibernate.tool.hbm2ddl.IndexMetadata; /** * Provides access to information about existing schema objects (tables, sequences etc) of existing database. diff --git a/hibernate-core/src/main/java/org/hibernate/service/schema/spi/TableInformation.java b/hibernate-core/src/main/java/org/hibernate/service/schema/spi/TableInformation.java index 5815521b66..ea879dc9b6 100644 --- a/hibernate-core/src/main/java/org/hibernate/service/schema/spi/TableInformation.java +++ b/hibernate-core/src/main/java/org/hibernate/service/schema/spi/TableInformation.java @@ -23,10 +23,8 @@ */ package org.hibernate.service.schema.spi; -import org.hibernate.metamodel.spi.relational.ForeignKey; import org.hibernate.metamodel.spi.relational.Identifier; import org.hibernate.metamodel.spi.relational.ObjectName; -import org.hibernate.tool.hbm2ddl.IndexMetadata; /** * Provides access to information about existing tables in the database diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java b/hibernate-core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java index 90fd42fe37..84df345c60 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ordering/antlr/OrderByFragmentParser.java @@ -32,7 +32,6 @@ import java.util.regex.Pattern; import antlr.CommonAST; import antlr.TokenStream; import antlr.collections.AST; - import org.jboss.logging.Logger; import org.hibernate.dialect.function.SQLFunction; diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java index a9eb8aad4b..5ed57f9393 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/DynamicMapComponentTuplizer.java @@ -1,76 +1,75 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC. - * - * 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.tuple.component; -import java.util.Map; - -import org.hibernate.mapping.Component; -import org.hibernate.mapping.Property; -import org.hibernate.metamodel.spi.binding.AttributeBinding; -import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding; -import org.hibernate.property.Getter; -import org.hibernate.property.PropertyAccessor; -import org.hibernate.property.PropertyAccessorFactory; -import org.hibernate.property.Setter; -import org.hibernate.tuple.DynamicMapInstantiator; -import org.hibernate.tuple.Instantiator; -import org.hibernate.tuple.PropertyFactory; - -/** - * A {@link ComponentTuplizer} specific to the dynamic-map entity mode. - * - * @author Gavin King - * @author Steve Ebersole - */ -public class DynamicMapComponentTuplizer extends AbstractComponentTuplizer { - - public Class getMappedClass() { - return Map.class; - } - - protected Instantiator buildInstantiator(Component component) { - return new DynamicMapInstantiator(); - } - - public DynamicMapComponentTuplizer(Component component) { - super(component); - } - - private PropertyAccessor buildPropertyAccessor(Property property) { - return PropertyAccessorFactory.getDynamicMapPropertyAccessor(); - } - - protected Getter buildGetter(Component component, Property prop) { - return buildPropertyAccessor(prop).getGetter( null, prop.getName() ); - } - - protected Setter buildSetter(Component component, Property prop) { - return buildPropertyAccessor(prop).getSetter( null, prop.getName() ); - } - - @Override - protected Instantiator buildInstantiator(CompositeAttributeBinding component) { - return new DynamicMapInstantiator(); - } -} +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC. + * + * 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.tuple.component; + +import java.util.Map; + +import org.hibernate.mapping.Component; +import org.hibernate.mapping.Property; +import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding; +import org.hibernate.property.Getter; +import org.hibernate.property.PropertyAccessor; +import org.hibernate.property.PropertyAccessorFactory; +import org.hibernate.property.Setter; +import org.hibernate.tuple.DynamicMapInstantiator; +import org.hibernate.tuple.Instantiator; + +/** + * A {@link ComponentTuplizer} specific to the dynamic-map entity mode. + * + * @author Gavin King + * @author Steve Ebersole + */ +public class DynamicMapComponentTuplizer extends AbstractComponentTuplizer { + + public Class getMappedClass() { + return Map.class; + } + + protected Instantiator buildInstantiator(Component component) { + return new DynamicMapInstantiator(); + } + + public DynamicMapComponentTuplizer(Component component) { + super(component); + } + + private PropertyAccessor buildPropertyAccessor(Property property) { + return PropertyAccessorFactory.getDynamicMapPropertyAccessor(); + } + + protected Getter buildGetter(Component component, Property prop) { + return buildPropertyAccessor(prop).getGetter( null, prop.getName() ); + } + + protected Setter buildSetter(Component component, Property prop) { + return buildPropertyAccessor(prop).getSetter( null, prop.getName() ); + } + + @Override + protected Instantiator buildInstantiator(CompositeAttributeBinding component) { + return new DynamicMapInstantiator(); + } +} diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java index e2387332ea..64348ea2a3 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/PojoComponentTuplizer.java @@ -23,6 +23,7 @@ * */ package org.hibernate.tuple.component; + import java.io.Serializable; import java.lang.reflect.Method; @@ -35,7 +36,6 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.mapping.Component; import org.hibernate.mapping.Property; -import org.hibernate.metamodel.spi.binding.AttributeBinding; import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding; import org.hibernate.property.BackrefPropertyAccessor; import org.hibernate.property.Getter; @@ -44,7 +44,6 @@ import org.hibernate.property.PropertyAccessorFactory; import org.hibernate.property.Setter; import org.hibernate.tuple.Instantiator; import org.hibernate.tuple.PojoInstantiator; -import org.hibernate.tuple.PropertyFactory; /** * A {@link ComponentTuplizer} specific to the pojo entity mode. diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java index 7748bc1c5b..3f070325e9 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java @@ -53,7 +53,6 @@ import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.PropertyGeneration; import org.hibernate.metamodel.spi.binding.AttributeBinding; -import org.hibernate.metamodel.spi.binding.BasicAttributeBinding; import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; import org.hibernate.metamodel.spi.binding.SingularNonAssociationAttributeBinding; diff --git a/hibernate-core/src/main/java/org/hibernate/type/EnumType.java b/hibernate-core/src/main/java/org/hibernate/type/EnumType.java index 809948c80f..bf5e984fa9 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/EnumType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/EnumType.java @@ -32,6 +32,9 @@ import java.sql.Types; import java.util.Properties; import javax.persistence.Enumerated; import javax.persistence.MapKeyEnumerated; + +import org.jboss.logging.Logger; + import org.hibernate.AssertionFailure; import org.hibernate.HibernateException; import org.hibernate.engine.spi.SessionImplementor; @@ -39,7 +42,6 @@ import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.ReflectHelper; import org.hibernate.usertype.DynamicParameterizedType; import org.hibernate.usertype.EnhancedUserType; -import org.jboss.logging.Logger; /** * Enum type mapper diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptorRegistry.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptorRegistry.java index 48e94a1dca..d4a0d2cbf8 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptorRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JavaTypeDescriptorRegistry.java @@ -24,7 +24,6 @@ package org.hibernate.type.descriptor.java; import java.io.Serializable; -import java.util.Comparator; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; diff --git a/hibernate-core/src/main/xjb/hbm-configuration-bindings.xjb b/hibernate-core/src/main/xjb/hbm-configuration-bindings.xjb index 59b19b75b1..bccec1fb25 100644 --- a/hibernate-core/src/main/xjb/hbm-configuration-bindings.xjb +++ b/hibernate-core/src/main/xjb/hbm-configuration-bindings.xjb @@ -1,8 +1,7 @@ + version="2.1"> diff --git a/hibernate-core/src/main/xjb/hbm-mapping-bindings.xjb b/hibernate-core/src/main/xjb/hbm-mapping-bindings.xjb index 1eb7c08402..87f1e04fb9 100644 --- a/hibernate-core/src/main/xjb/hbm-mapping-bindings.xjb +++ b/hibernate-core/src/main/xjb/hbm-mapping-bindings.xjb @@ -1,10 +1,9 @@ + xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" + jaxb:extensionBindingPrefixes="inheritance" + version="2.1"> diff --git a/hibernate-core/src/main/xjb/orm-bindings.xjb b/hibernate-core/src/main/xjb/orm-bindings.xjb index 126604a6b1..a1d1a562fe 100644 --- a/hibernate-core/src/main/xjb/orm-bindings.xjb +++ b/hibernate-core/src/main/xjb/orm-bindings.xjb @@ -1,10 +1,9 @@ + xmlns:inheritance="http://jaxb2-commons.dev.java.net/basic/inheritance" + jaxb:extensionBindingPrefixes="inheritance" + version="2.1"> diff --git a/hibernate-core/src/test/java/org/hibernate/cache/spi/NaturalIdCacheKeyTest.java b/hibernate-core/src/test/java/org/hibernate/cache/spi/NaturalIdCacheKeyTest.java index 7f32b1ce23..f7009c989b 100644 --- a/hibernate-core/src/test/java/org/hibernate/cache/spi/NaturalIdCacheKeyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/cache/spi/NaturalIdCacheKeyTest.java @@ -23,6 +23,20 @@ */ package org.hibernate.cache.spi; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import org.junit.Test; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import org.hibernate.engine.spi.SessionFactoryImplementor; +import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.persister.entity.EntityPersister; +import org.hibernate.type.Type; + import static junit.framework.Assert.assertEquals; import static org.junit.Assert.assertArrayEquals; import static org.mockito.Matchers.anyObject; @@ -30,19 +44,6 @@ import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; - -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.engine.spi.SessionImplementor; -import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.type.Type; -import org.junit.Test; -import org.mockito.invocation.InvocationOnMock; -import org.mockito.stubbing.Answer; - public class NaturalIdCacheKeyTest { @Test public void testSerializationRoundTrip() throws Exception { diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/PostgreSQL81DialectTestCase.java b/hibernate-core/src/test/java/org/hibernate/dialect/PostgreSQL81DialectTestCase.java index a2640c07b0..faf0cd1fd4 100644 --- a/hibernate-core/src/test/java/org/hibernate/dialect/PostgreSQL81DialectTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/dialect/PostgreSQL81DialectTestCase.java @@ -23,19 +23,19 @@ */ package org.hibernate.dialect; +import java.sql.SQLException; + import org.junit.Test; -import java.sql.SQLException; import org.hibernate.JDBCException; import org.hibernate.PessimisticLockException; import org.hibernate.exception.LockAcquisitionException; import org.hibernate.exception.spi.SQLExceptionConversionDelegate; - import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseUnitTestCase; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; /** diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/AssertSourcesTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/AssertSourcesTest.java index 56f094e089..00b21f8c20 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/AssertSourcesTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/AssertSourcesTest.java @@ -25,6 +25,8 @@ package org.hibernate.metamodel.internal.source; import java.util.Iterator; +import org.junit.Test; + import org.hibernate.EntityMode; import org.hibernate.id.EntityIdentifierNature; import org.hibernate.internal.util.StringHelper; @@ -40,15 +42,11 @@ import org.hibernate.metamodel.spi.source.EntityHierarchy; import org.hibernate.metamodel.spi.source.IdentifierSource; import org.hibernate.metamodel.spi.source.RootEntitySource; import org.hibernate.metamodel.spi.source.SimpleIdentifierSource; -import org.hibernate.metamodel.spi.source.SingularAttributeNature; import org.hibernate.metamodel.spi.source.SingularAttributeSource; import org.hibernate.metamodel.spi.source.TableSource; import org.hibernate.metamodel.spi.source.TableSpecificationSource; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; - -import org.junit.Test; - import org.hibernate.testing.junit4.BaseUnitTestCase; import static org.junit.Assert.assertEquals; @@ -134,7 +132,7 @@ public class AssertSourcesTest extends BaseUnitTestCase { assertTrue( identifierAttributeSource.isSingular() ); assertFalse( identifierAttributeSource.isVirtualAttribute() ); assertFalse( identifierAttributeSource.isLazy() ); - assertEquals( SingularAttributeNature.BASIC, identifierAttributeSource.getNature() ); + assertEquals( SingularAttributeSource.Nature.BASIC, identifierAttributeSource.getNature() ); assertEquals( PropertyGeneration.INSERT, identifierAttributeSource.getGeneration() ); // assertNull( identifierAttributeSource.getPropertyAccessorName() ); diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/User.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/User.java index ad0b3d6fdc..26fa3aab63 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/User.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/User.java @@ -23,6 +23,7 @@ */ package org.hibernate.metamodel.internal.source; +import java.util.Date; import javax.persistence.Column; import javax.persistence.Embeddable; import javax.persistence.Entity; @@ -31,7 +32,6 @@ import javax.persistence.Id; import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Version; -import java.util.Date; import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.NaturalId; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableBindingTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableBindingTest.java index 86d2912b87..cf4513e340 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableBindingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/EmbeddableBindingTest.java @@ -31,6 +31,8 @@ import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.Id; +import org.junit.Test; + import org.hibernate.annotations.Parent; import org.hibernate.annotations.Target; import org.hibernate.metamodel.spi.binding.BasicAttributeBinding; @@ -39,8 +41,6 @@ import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase; import org.hibernate.testing.junit4.Resources; -import org.junit.Test; - import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertTrue; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/IdentifierGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/IdentifierGeneratorTest.java index 18f9606f11..180d9b4f8c 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/IdentifierGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/IdentifierGeneratorTest.java @@ -43,7 +43,6 @@ import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.binding.EntityIdentifier; import org.hibernate.metamodel.spi.source.MappingException; import org.hibernate.service.ServiceRegistryBuilder; - import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase; import org.hibernate.testing.junit4.Resources; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/NaturalIdBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/NaturalIdBindingTests.java index 0e3478cff7..a01d0681a5 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/NaturalIdBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/NaturalIdBindingTests.java @@ -9,8 +9,6 @@ import javax.persistence.ManyToOne; import org.junit.Test; -import static org.junit.Assert.*; - import org.hibernate.annotations.NaturalId; import org.hibernate.annotations.NaturalIdCache; import org.hibernate.metamodel.spi.binding.EntityBinding; @@ -21,6 +19,12 @@ import org.hibernate.metamodel.spi.relational.UniqueKey; import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase; import org.hibernate.testing.junit4.Resources; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + /** * @author Strong Liu */ diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/OneToManyBindingTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/OneToManyBindingTest.java new file mode 100644 index 0000000000..0f1c2b6913 --- /dev/null +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/OneToManyBindingTest.java @@ -0,0 +1,33 @@ +package org.hibernate.metamodel.internal.source.annotations.entity; + +import org.junit.Test; + +import org.hibernate.metamodel.spi.binding.AttributeBinding; +import org.hibernate.metamodel.spi.binding.EntityBinding; +import org.hibernate.test.annotations.loader.Player; +import org.hibernate.test.annotations.loader.Team; +import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase; +import org.hibernate.testing.junit4.Resources; + +import static org.junit.Assert.assertNotNull; + +/** + * @author Strong Liu + */ +public class OneToManyBindingTest extends BaseAnnotationBindingTestCase { + @Test + @Resources(annotatedClasses = { Team.class, Player.class}) + public void testPluralAttributeBindingTest(){ + EntityBinding playerBinding = getEntityBinding( Player.class ); + assertNotNull( playerBinding ); + for( AttributeBinding attributeBinding : playerBinding.attributeBindings()){ + System.out.println(attributeBinding.getAttribute().getName()); + } + System.out.println("-----------"); + EntityBinding teamBinding = getEntityBinding( Team.class ); + assertNotNull( teamBinding ); + for(AttributeBinding attributeBinding : teamBinding.attributeBindings()){ + System.out.println(attributeBinding.getAttribute().getName()); + } + } +} diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/SecondaryTableTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/SecondaryTableTest.java index cd9d7fa8ff..71f60d9758 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/SecondaryTableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/entity/SecondaryTableTest.java @@ -29,6 +29,8 @@ import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.SecondaryTable; +import org.junit.Test; + import org.hibernate.AssertionFailure; import org.hibernate.metamodel.spi.binding.BasicAttributeBinding; import org.hibernate.metamodel.spi.binding.EntityBinding; @@ -38,8 +40,6 @@ import org.hibernate.metamodel.spi.relational.Table; import org.hibernate.testing.junit4.BaseAnnotationBindingTestCase; import org.hibernate.testing.junit4.Resources; -import org.junit.Test; - import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertSame; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/global/FetchProfileBinderTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/global/FetchProfileBinderTest.java index 3b8771f070..a6c98a618e 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/global/FetchProfileBinderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/global/FetchProfileBinderTest.java @@ -26,6 +26,9 @@ package org.hibernate.metamodel.internal.source.annotations.global; import java.util.Iterator; import org.jboss.jandex.Index; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.hibernate.MappingException; import org.hibernate.annotations.FetchMode; @@ -38,11 +41,6 @@ import org.hibernate.metamodel.internal.source.annotations.util.JandexHelper; import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.internal.StandardServiceRegistryImpl; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - import org.hibernate.testing.junit4.BaseUnitTestCase; import static junit.framework.Assert.fail; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/xml/OrmXmlParserTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/xml/OrmXmlParserTests.java index be5811f0d9..414b2dea13 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/xml/OrmXmlParserTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/internal/source/annotations/xml/OrmXmlParserTests.java @@ -26,8 +26,8 @@ package org.hibernate.metamodel.internal.source.annotations.xml; import org.junit.Test; import org.hibernate.metamodel.MetadataSources; -import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.internal.MetadataImpl; +import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.source.MappingException; import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.testing.junit4.BaseUnitTestCase; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/AbstractBasicBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/AbstractBasicBindingTests.java index cdfc022c83..ee1760fc05 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/AbstractBasicBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/AbstractBasicBindingTests.java @@ -26,9 +26,13 @@ package org.hibernate.metamodel.spi.binding; import java.sql.Types; import java.util.List; +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + import org.hibernate.FetchMode; import org.hibernate.engine.FetchTiming; -import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.engine.spi.CascadeStyles; import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.internal.MetadataImpl; @@ -45,16 +49,10 @@ import org.hibernate.metamodel.spi.relational.Value; import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.service.internal.StandardServiceRegistryImpl; +import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.type.LongType; import org.hibernate.type.StringType; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import org.hibernate.testing.junit4.BaseUnitTestCase; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/BasicCollectionBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/BasicCollectionBindingTests.java index 6183068d9d..ee26f585b2 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/BasicCollectionBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/BasicCollectionBindingTests.java @@ -34,7 +34,7 @@ import org.hibernate.engine.FetchTiming; import org.hibernate.metamodel.MetadataSourceProcessingOrder; import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.internal.MetadataImpl; -import org.hibernate.metamodel.spi.domain.PluralAttributeNature; +import org.hibernate.metamodel.spi.domain.PluralAttribute; import org.hibernate.metamodel.spi.relational.ForeignKey; import org.hibernate.metamodel.spi.relational.Identifier; import org.hibernate.metamodel.spi.relational.TableSpecification; @@ -198,8 +198,8 @@ public class BasicCollectionBindingTests extends BaseUnitTestCase { ); assertFalse( keyBinding.isInverse() ); assertEquals( - PluralAttributeElementNature.BASIC, - collectionBinding.getPluralAttributeElementBinding().getPluralAttributeElementNature() + PluralAttributeElementBinding.Nature.BASIC, + collectionBinding.getPluralAttributeElementBinding().getNature() ); assertEquals( expectedElementJavaClass.getName(), @@ -213,10 +213,10 @@ public class BasicCollectionBindingTests extends BaseUnitTestCase { assertEquals( 1, collectionBinding.getPluralAttributeElementBinding().getRelationalValueBindings().size() ); RelationalValueBinding elementRelationalValueBinding = collectionBinding.getPluralAttributeElementBinding().getRelationalValueBindings().get( 0 ); assertEquals( expectedElementNullable, elementRelationalValueBinding.isNullable() ); - if ( collectionBinding.getAttribute().getNature() == PluralAttributeNature.BAG ) { + if ( collectionBinding.getAttribute().getNature() == PluralAttribute.Nature.BAG ) { assertEquals( 0, collectionTable.getPrimaryKey().getColumnSpan() ); } - else if ( collectionBinding.getAttribute().getNature() == PluralAttributeNature.SET ) { + else if ( collectionBinding.getAttribute().getNature() == PluralAttribute.Nature.SET ) { if ( expectedElementNullable ) { assertEquals( 0, collectionTable.getPrimaryKey().getColumnSpan() ); } diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.java index 98ccf61916..0bc59b7d97 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/EntityWithBasicCollections.java @@ -30,7 +30,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; - import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.Id; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/JoinedSubclassBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/JoinedSubclassBindingTests.java index a33eaae0cd..76adac9dd6 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/JoinedSubclassBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/JoinedSubclassBindingTests.java @@ -23,21 +23,21 @@ */ package org.hibernate.metamodel.spi.binding; -import javax.persistence.*; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; import javax.persistence.InheritanceType; -import org.hibernate.metamodel.MetadataSources; -import org.hibernate.metamodel.internal.MetadataImpl; -import org.hibernate.service.ServiceRegistryBuilder; -import org.hibernate.service.internal.StandardServiceRegistryImpl; - import org.junit.After; import org.junit.Before; import org.junit.Test; +import org.hibernate.metamodel.MetadataSources; +import org.hibernate.metamodel.internal.MetadataImpl; +import org.hibernate.service.ServiceRegistryBuilder; +import org.hibernate.service.internal.StandardServiceRegistryImpl; import org.hibernate.testing.junit4.BaseUnitTestCase; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; /** diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java index cb4f510a07..bc0bf55727 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/UnidirectionalManyToManyBindingTests.java @@ -30,7 +30,6 @@ import org.junit.Test; import org.hibernate.metamodel.MetadataSourceProcessingOrder; import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.internal.MetadataImpl; -import org.hibernate.metamodel.spi.binding.EntityWithUnidirectionalManyToMany; import org.hibernate.metamodel.spi.relational.Column; import org.hibernate.metamodel.spi.relational.Identifier; import org.hibernate.service.ServiceRegistryBuilder; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java index bfeb661fc2..db9be1dfda 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/binding/onetomany/UnidirectionalOneToManyBindingTests.java @@ -40,7 +40,7 @@ import org.hibernate.metamodel.internal.MetadataImpl; import org.hibernate.metamodel.spi.binding.EntityBinding; import org.hibernate.metamodel.spi.binding.HibernateTypeDescriptor; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; -import org.hibernate.metamodel.spi.binding.PluralAttributeElementNature; +import org.hibernate.metamodel.spi.binding.PluralAttributeElementBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeKeyBinding; import org.hibernate.metamodel.spi.binding.SimpleEntity; import org.hibernate.metamodel.spi.binding.SingularAttributeBinding; @@ -181,8 +181,8 @@ public class UnidirectionalOneToManyBindingTests extends BaseUnitTestCase { FetchTiming expectedFetchTiming, boolean expectedNullableCollectionKey) { Assert.assertEquals( - PluralAttributeElementNature.ONE_TO_MANY, - collectionBinding.getPluralAttributeElementBinding().getPluralAttributeElementNature() + PluralAttributeElementBinding.Nature.ONE_TO_MANY, + collectionBinding.getPluralAttributeElementBinding().getNature() ); assertSame( collectionBinding, diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractConstraintNameTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractConstraintNameTests.java index 102ddb1e59..41e0577b5a 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractConstraintNameTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractConstraintNameTests.java @@ -29,7 +29,6 @@ import org.junit.Test; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; - import org.hibernate.testing.junit4.BaseUnitTestCase; import static org.junit.Assert.assertEquals; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractGeneratedIdColumnTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractGeneratedIdColumnTests.java index f75da82ce5..048f207e1c 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractGeneratedIdColumnTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/AbstractGeneratedIdColumnTests.java @@ -32,7 +32,6 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.metamodel.MetadataSources; import org.hibernate.metamodel.internal.MetadataImpl; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ColumnAliasTest.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ColumnAliasTest.java index f38cd9876b..e41788bf04 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ColumnAliasTest.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ColumnAliasTest.java @@ -27,14 +27,14 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import org.hibernate.MappingException; import org.hibernate.dialect.Dialect; import org.hibernate.testing.junit4.BaseUnitTestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + /** * * NOTE: the table number is automatically statically incremented every time diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ForeignKeyConstraintNameTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ForeignKeyConstraintNameTests.java index 9843f78d45..315a0a9bce 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ForeignKeyConstraintNameTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ForeignKeyConstraintNameTests.java @@ -23,11 +23,6 @@ */ package org.hibernate.metamodel.spi.relational; -import java.util.Collections; -import java.util.List; - -import org.junit.Test; - /** * @author Gail Badner */ diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ObjectNameTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ObjectNameTests.java index 7cec456443..145d7e4f7b 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ObjectNameTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/ObjectNameTests.java @@ -27,7 +27,6 @@ import org.junit.Test; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; - import org.hibernate.testing.junit4.BaseUnitTestCase; import static org.junit.Assert.assertEquals; diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/PrimaryKeyConstraintNameTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/PrimaryKeyConstraintNameTests.java index 2fa03cb252..9b3905af46 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/PrimaryKeyConstraintNameTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/PrimaryKeyConstraintNameTests.java @@ -24,7 +24,6 @@ package org.hibernate.metamodel.spi.relational; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; /** * @author Gail Badner diff --git a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/TableManipulationTests.java b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/TableManipulationTests.java index 3e54985a9d..21afdb6d3a 100644 --- a/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/TableManipulationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/metamodel/spi/relational/TableManipulationTests.java @@ -29,7 +29,6 @@ import org.junit.Test; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; - import org.hibernate.testing.junit4.BaseUnitTestCase; import static org.junit.Assert.assertEquals; diff --git a/hibernate-core/src/test/java/org/hibernate/sharedSession/SessionWithSharedConnectionTest.java b/hibernate-core/src/test/java/org/hibernate/sharedSession/SessionWithSharedConnectionTest.java index 72578949b2..94436ee48d 100644 --- a/hibernate-core/src/test/java/org/hibernate/sharedSession/SessionWithSharedConnectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/sharedSession/SessionWithSharedConnectionTest.java @@ -23,26 +23,30 @@ */ package org.hibernate.sharedSession; -import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; -import org.hibernate.engine.transaction.spi.TransactionCoordinator; -import org.hibernate.event.service.spi.EventListenerRegistry; -import org.hibernate.event.spi.*; -import org.hibernate.testing.FailureExpected; +import java.lang.reflect.Field; +import java.util.List; + import org.junit.Test; import org.hibernate.IrrelevantEntity; import org.hibernate.Session; import org.hibernate.engine.spi.SessionImplementor; +import org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl; import org.hibernate.engine.transaction.spi.TransactionContext; +import org.hibernate.engine.transaction.spi.TransactionCoordinator; +import org.hibernate.event.service.spi.EventListenerRegistry; +import org.hibernate.event.spi.EventType; +import org.hibernate.event.spi.PostInsertEvent; +import org.hibernate.event.spi.PostInsertEventListener; import org.hibernate.persister.entity.EntityPersister; - import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import java.lang.reflect.Field; -import java.util.List; - -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; /** * @author Steve Ebersole diff --git a/hibernate-core/src/test/java/org/hibernate/sql/TemplateTest.java b/hibernate-core/src/test/java/org/hibernate/sql/TemplateTest.java index 80a69ce7e3..38d3adae87 100644 --- a/hibernate-core/src/test/java/org/hibernate/sql/TemplateTest.java +++ b/hibernate-core/src/test/java/org/hibernate/sql/TemplateTest.java @@ -33,10 +33,9 @@ import org.hibernate.dialect.HSQLDialect; import org.hibernate.dialect.function.SQLFunctionRegistry; import org.hibernate.persister.entity.PropertyMapping; import org.hibernate.sql.ordering.antlr.ColumnMapper; -import org.hibernate.testing.junit4.BaseUnitTestCase; - import org.hibernate.sql.ordering.antlr.ColumnReference; import org.hibernate.sql.ordering.antlr.SqlValueReference; +import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.type.Type; import static org.junit.Assert.assertEquals; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/ElementCollectionSortingTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/ElementCollectionSortingTest.java index e1d5db9b24..4a9b61a24e 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/ElementCollectionSortingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/ElementCollectionSortingTest.java @@ -23,10 +23,9 @@ */ package org.hibernate.test.annotations.collectionelement.ordered; -import org.hibernate.Session; - import org.junit.Test; +import org.hibernate.Session; import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/Person.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/Person.java index 3db5a4fa51..c33c929cff 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/Person.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/collectionelement/ordered/Person.java @@ -23,6 +23,8 @@ */ package org.hibernate.test.annotations.collectionelement.ordered; +import java.util.HashSet; +import java.util.Set; import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -30,9 +32,6 @@ import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OrderBy; -import java.util.HashSet; -import java.util.Set; - import org.hibernate.annotations.GenericGenerator; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/DollarValueUserType.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/DollarValueUserType.java index d31dde62fc..42881620ef 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/DollarValueUserType.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/DollarValueUserType.java @@ -24,7 +24,6 @@ package org.hibernate.test.annotations.embeddables; import java.io.Serializable; -import java.math.BigDecimal; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/EmbeddableIntegratorTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/EmbeddableIntegratorTest.java index 8b71febc67..86fb4e3987 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/EmbeddableIntegratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/EmbeddableIntegratorTest.java @@ -23,14 +23,14 @@ */ package org.hibernate.test.annotations.embeddables; -import static org.junit.Assert.assertEquals; - import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.LinkedHashSet; import java.util.List; +import org.junit.Test; + import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; @@ -44,7 +44,8 @@ import org.hibernate.service.classloading.internal.ClassLoaderServiceImpl; import org.hibernate.service.classloading.spi.ClassLoaderService; import org.hibernate.service.internal.BootstrapServiceRegistryImpl; import org.hibernate.testing.junit4.BaseUnitTestCase; -import org.junit.Test; + +import static org.junit.Assert.assertEquals; /** * @author Chris Pheby diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/Investor.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/Investor.java index d52c041fbc..7ee0935595 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/Investor.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/embeddables/Investor.java @@ -25,7 +25,6 @@ package org.hibernate.test.annotations.embeddables; import java.util.ArrayList; import java.util.List; - import javax.persistence.ElementCollection; import javax.persistence.Entity; import javax.persistence.FetchType; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/EmbeddedTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/EmbeddedTest.java index aecff14c5a..cba60810f4 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/EmbeddedTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/embedded/EmbeddedTest.java @@ -23,7 +23,6 @@ */ package org.hibernate.test.annotations.embedded; -import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.List; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/HibernateAnnotationMappingTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/HibernateAnnotationMappingTest.java index 6200ce36e6..ef64c9a004 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/HibernateAnnotationMappingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/HibernateAnnotationMappingTest.java @@ -23,16 +23,17 @@ */ package org.hibernate.test.annotations.entity; -import static org.junit.Assert.fail; - import java.util.ConcurrentModificationException; +import org.junit.Test; + import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseUnitTestCase; -import org.junit.Test; + +import static org.junit.Assert.fail; /** * @author Guenther Demetz diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/NewCustomEntityMappingAnnotationsTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/NewCustomEntityMappingAnnotationsTest.java index 9597d953cd..dbface1877 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/NewCustomEntityMappingAnnotationsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/entity/NewCustomEntityMappingAnnotationsTest.java @@ -23,10 +23,9 @@ */ package org.hibernate.test.annotations.entity; -import org.hibernate.mapping.RootClass; - import org.junit.Test; +import org.hibernate.mapping.RootClass; import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EntityEnum.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EntityEnum.java index 8016c10abc..a420a1cfaa 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EntityEnum.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EntityEnum.java @@ -5,6 +5,7 @@ import javax.persistence.EnumType; import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; + import org.hibernate.annotations.Type; import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EnumeratedTypeTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EnumeratedTypeTest.java index 4c96a0d3c4..6bd7df24ff 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EnumeratedTypeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/EnumeratedTypeTest.java @@ -1,6 +1,9 @@ package org.hibernate.test.annotations.enumerated; import java.io.Serializable; + +import org.junit.Test; + import org.hibernate.Session; import org.hibernate.cfg.Configuration; import org.hibernate.criterion.Restrictions; @@ -9,9 +12,11 @@ import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.type.EnumType; import org.hibernate.type.Type; -import org.junit.Test; + +import static org.hibernate.test.annotations.enumerated.EntityEnum.Common; +import static org.hibernate.test.annotations.enumerated.EntityEnum.FirstLetter; +import static org.hibernate.test.annotations.enumerated.EntityEnum.LastNumber; import static org.junit.Assert.assertEquals; -import static org.hibernate.test.annotations.enumerated.EntityEnum.*; /** * Test type definition for enum diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/FirstLetterType.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/FirstLetterType.java index 83ab61f2ee..f09c609779 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/FirstLetterType.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/FirstLetterType.java @@ -4,6 +4,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; + import org.hibernate.HibernateException; import org.hibernate.engine.spi.SessionImplementor; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/LastNumberType.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/LastNumberType.java index 65e38525f9..4930ae5fd9 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/LastNumberType.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/enumerated/LastNumberType.java @@ -4,6 +4,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; + import org.hibernate.HibernateException; import org.hibernate.engine.spi.SessionImplementor; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/secondarytable/SecondaryTableTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/secondarytable/SecondaryTableTest.java index 0ec3d33178..cf6d4b7811 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/secondarytable/SecondaryTableTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/secondarytable/SecondaryTableTest.java @@ -1,9 +1,10 @@ package org.hibernate.test.annotations.filter.secondarytable; +import org.junit.Assert; +import org.junit.Test; + import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.junit.Assert; -import org.junit.Test; @FailureExpectedWithNewMetamodel public class SecondaryTableTest extends BaseCoreFunctionalTestCase { diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/SubClassTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/SubClassTest.java index b1f2dc1979..1790c3e675 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/SubClassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/SubClassTest.java @@ -1,9 +1,9 @@ package org.hibernate.test.annotations.filter.subclass; import junit.framework.Assert; +import org.junit.Test; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; -import org.junit.Test; public abstract class SubClassTest extends BaseCoreFunctionalTestCase{ diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/Club.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/Club.java index 3932a4f5ed..484d93f5d1 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/Club.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/Club.java @@ -2,7 +2,6 @@ package org.hibernate.test.annotations.filter.subclass.joined; import java.util.HashSet; import java.util.Set; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/JoinedSubClassTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/JoinedSubClassTest.java index a6b8ab93a9..1613dbc703 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/JoinedSubClassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/filter/subclass/joined/JoinedSubClassTest.java @@ -1,10 +1,10 @@ package org.hibernate.test.annotations.filter.subclass.joined; import junit.framework.Assert; +import org.junit.Test; import org.hibernate.test.annotations.filter.subclass.SubClassTest; import org.hibernate.testing.FailureExpectedWithNewMetamodel; -import org.junit.Test; @FailureExpectedWithNewMetamodel public class JoinedSubClassTest extends SubClassTest{ diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/genericsinheritance/GenericsInheritanceTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/genericsinheritance/GenericsInheritanceTest.java index 8b27823cc2..0ab1975070 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/genericsinheritance/GenericsInheritanceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/genericsinheritance/GenericsInheritanceTest.java @@ -26,7 +26,6 @@ package org.hibernate.test.annotations.genericsinheritance; import org.junit.Test; import org.hibernate.Session; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; /** diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/id/sequences/HibernateSequenceTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/id/sequences/HibernateSequenceTest.java index b4c21e73bd..e53ab9efb2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/id/sequences/HibernateSequenceTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/id/sequences/HibernateSequenceTest.java @@ -6,7 +6,6 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; -import org.hibernate.cfg.Environment; import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.enhanced.SequenceStyleGenerator; import org.hibernate.mapping.Table; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/LoaderTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/LoaderTest.java index f6046fc905..a50365d6ca 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/LoaderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/LoaderTest.java @@ -30,7 +30,6 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.Transaction; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; @@ -38,7 +37,6 @@ import static org.junit.Assert.assertEquals; /** * @author Emmanuel Bernard */ -@FailureExpectedWithNewMetamodel public class LoaderTest extends BaseCoreFunctionalTestCase { @Override protected String[] getXmlFiles() { @@ -49,7 +47,7 @@ public class LoaderTest extends BaseCoreFunctionalTestCase { @Override protected Class[] getAnnotatedClasses() { - return new Class[]{ + return new Class[] { Player.class, Team.class }; @@ -57,37 +55,27 @@ public class LoaderTest extends BaseCoreFunctionalTestCase { @Test public void testBasic() throws Exception { - Session s = openSession( ); + Session s = openSession(); Transaction tx = s.beginTransaction(); Team t = new Team(); Player p = new Player(); - p.setName("me"); - t.getPlayers().add(p); - p.setTeam(t); + p.setName( "me" ); + t.getPlayers().add( p ); + p.setTeam( t ); + s.persist( p ); + s.persist( t ); + tx.commit(); + s.close(); - try { - s.persist(p); - s.persist(t); - tx.commit(); - s.close(); - - s= openSession( ); - tx = s.beginTransaction(); - Team t2 = (Team)s.load(Team.class,new Long(1)); - Set players = t2.getPlayers(); - Iterator iterator = players.iterator(); - assertEquals("me", iterator.next().getName()); - tx.commit(); - - } - catch (Exception e) { - e.printStackTrace(); - if ( tx != null ) tx.rollback(); - } - finally { - s.close(); - } + s = openSession(); + tx = s.beginTransaction(); + Team t2 = (Team) s.load( Team.class, t.getId() ); + Set players = t2.getPlayers(); + Iterator iterator = players.iterator(); + assertEquals( "me", iterator.next().getName() ); + tx.commit(); + s.close(); } } diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/Team.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/Team.java index f6e745e605..bc09d8e3d2 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/Team.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/loader/Team.java @@ -1,4 +1,5 @@ package org.hibernate.test.annotations.loader; + import java.util.HashSet; import java.util.Set; import javax.persistence.Entity; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetomany/City.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetomany/City.java index b03aba3071..8c21a7c8e2 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/onetomany/City.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/onetomany/City.java @@ -1,9 +1,9 @@ //$Id$ package org.hibernate.test.annotations.onetomany; + import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; diff --git a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java index 0b3b8edcd2..5ea9240585 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/annotations/referencedcolumnname/ReferencedColumnNameTest.java @@ -30,8 +30,8 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.Transaction; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.criterion.Restrictions; +import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; diff --git a/hibernate-core/src/test/java/org/hibernate/test/bidir/onetomany/nonindexed/BidirectionalOneToManyInverseTest.java b/hibernate-core/src/test/java/org/hibernate/test/bidir/onetomany/nonindexed/BidirectionalOneToManyInverseTest.java index 4b4ef8a841..0616babbdf 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/bidir/onetomany/nonindexed/BidirectionalOneToManyInverseTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/bidir/onetomany/nonindexed/BidirectionalOneToManyInverseTest.java @@ -23,11 +23,6 @@ */ package org.hibernate.test.bidir.onetomany.nonindexed; -import org.junit.Test; - -import org.hibernate.cfg.Configuration; -import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; - /** * @author Gail Badner */ diff --git a/hibernate-core/src/test/java/org/hibernate/test/cache/InsertedDataTest.java b/hibernate-core/src/test/java/org/hibernate/test/cache/InsertedDataTest.java index a3ab1fb36b..32d64c5159 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/cache/InsertedDataTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/cache/InsertedDataTest.java @@ -31,7 +31,6 @@ import org.hibernate.Session; import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.service.ServiceRegistryBuilder; -import org.hibernate.testing.FailureExpectedWithNewMetamodel; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; diff --git a/hibernate-core/src/test/java/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java b/hibernate-core/src/test/java/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java index d91d9bf955..a6d4350de1 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/cascade/circle/CascadeMergeToChildBeforeParentTest.java @@ -23,10 +23,6 @@ */ package org.hibernate.test.cascade.circle; -import static org.hamcrest.core.IsInstanceOf.instanceOf; - -import static org.junit.Assert.assertThat; - import org.junit.Test; import org.hibernate.Session; @@ -34,6 +30,9 @@ import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Environment; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import static org.hamcrest.core.IsInstanceOf.instanceOf; +import static org.junit.Assert.assertThat; + /** * The test case uses the following model: * diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java index ece105aacc..48af5e7b35 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/cache/CacheConfigurationTest.java @@ -23,10 +23,11 @@ */ package org.hibernate.test.cfg.cache; +import org.junit.Test; + import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.testing.junit4.BaseUnitTestCase; -import org.junit.Test; /** * Tests using of cacheable configuration files. diff --git a/hibernate-core/src/test/java/org/hibernate/test/cfg/orm-serializable.xml b/hibernate-core/src/test/java/org/hibernate/test/cfg/orm-serializable.xml index e9241ce3f3..46a2702a2c 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/cfg/orm-serializable.xml +++ b/hibernate-core/src/test/java/org/hibernate/test/cfg/orm-serializable.xml @@ -1,7 +1,6 @@ + version="2.0"> diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema.xml index 9a9689492f..19624418c6 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema.xml @@ -1,8 +1,7 @@ + version="2.0"> XML_SCHEMA diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema2.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema2.xml index 43ad5da84a..60b5d3855c 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema2.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/default-schema2.xml @@ -1,8 +1,7 @@ + version="2.0"> org.hibernate.metamodel.internal.source.annotations.xml.mocker XML_SCHEMA XML_CATALOG diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/entity-metadata-complete.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/entity-metadata-complete.xml index 25b5e62cd1..6bfcd41638 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/entity-metadata-complete.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/entity-metadata-complete.xml @@ -1,8 +1,7 @@ + version="2.0"> org.hibernate.metamodel.internal.source.annotations.xml.mocker diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/listener.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/listener.xml index 3a36c08035..28054ccda9 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/listener.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/listener.xml @@ -1,7 +1,6 @@ diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/override-to-mappedsuperclass.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/override-to-mappedsuperclass.xml index a84268bacb..bd443d11e5 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/override-to-mappedsuperclass.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/override-to-mappedsuperclass.xml @@ -1,7 +1,6 @@ org.hibernate.metamodel.internal.source.annotations.xml.mocker diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/persistence-metadata.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/persistence-metadata.xml index 966a111145..eb9ac832b5 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/persistence-metadata.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/mocker/persistence-metadata.xml @@ -1,7 +1,6 @@ diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-father.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-father.xml index 38057ac227..1eb4cb4362 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-father.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-father.xml @@ -1,7 +1,6 @@ org.hibernate.metamodel.internal.source.annotations.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-invalid.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-invalid.xml index 0323af6cf1..c83f0752ad 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-invalid.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-invalid.xml @@ -1,7 +1,6 @@ org.hibernate.metamodel.internal.source.annotations.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-quote-identifier.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-quote-identifier.xml index 9f50560d69..58a67f68ae 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-quote-identifier.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-quote-identifier.xml @@ -1,7 +1,6 @@ diff --git a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-star.xml b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-star.xml index d4eb5d63b3..fa0fd7ad49 100644 --- a/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-star.xml +++ b/hibernate-core/src/test/resources/org/hibernate/metamodel/internal/source/annotations/xml/orm-star.xml @@ -1,7 +1,6 @@ org.hibernate.metamodel.internal.source.annotations.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Boy.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Boy.xml index e5e9306101..7541c015c4 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Boy.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Boy.xml @@ -1,6 +1,5 @@ org.hibernate.test.annotations.access.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Cook.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Cook.xml index c933621fdd..1c7dd2d796 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Cook.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Cook.xml @@ -1,6 +1,5 @@ org.hibernate.test.annotations.access.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Crew.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Crew.xml index 0294c8ee1d..45d0aaef98 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Crew.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Crew.xml @@ -1,6 +1,5 @@ org.hibernate.test.annotations.access.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/RentalCar.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/RentalCar.xml index 97a410e2cc..6b391c20bc 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/RentalCar.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/RentalCar.xml @@ -1,6 +1,5 @@ org.hibernate.test.annotations.access.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist.xml index e87a3f705e..50aefd22ee 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist.xml @@ -1,6 +1,5 @@ Mapping for Tourist entity org.hibernate.test.annotations.access.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist2.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist2.xml index 08f53f9459..1b2b28fb8d 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist2.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist2.xml @@ -1,6 +1,5 @@ Mapping for Tourist entity diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist3.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist3.xml index 02d8d5af53..d262536db0 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist3.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist3.xml @@ -1,6 +1,5 @@ Mapping for Tourist entity org.hibernate.test.annotations.access.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist4.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist4.xml index 5295c3d184..c9d1c0751f 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist4.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/access/xml/Tourist4.xml @@ -1,6 +1,5 @@ Mapping for Tourist entity org.hibernate.test.annotations.access.xml diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/duplicatedgenerator/orm.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/duplicatedgenerator/orm.xml index 759beda1dc..b10d19720f 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/duplicatedgenerator/orm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/duplicatedgenerator/orm.xml @@ -1,7 +1,6 @@ org.hibernate.test.annotations.onetomany diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml index 825e613de2..0e0de5776c 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/onetoone/orm.xml @@ -1,7 +1,6 @@ org.hibernate.test.annotations.onetoone diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/orm.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/orm.xml index 3c1ee5dcc2..ddee9b3bb3 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/orm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/orm.xml @@ -1,7 +1,6 @@ diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/query/orm.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/query/orm.xml index 9af843dcfb..d3947f4560 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/query/orm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/query/orm.xml @@ -1,7 +1,6 @@ diff --git a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/orm.xml b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/orm.xml index 1ac02c74c7..6da76869f5 100644 --- a/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/orm.xml +++ b/hibernate-core/src/test/resources/org/hibernate/test/annotations/xml/ejb3/orm.xml @@ -1,7 +1,6 @@