-
Notifications
You must be signed in to change notification settings - Fork 0
Metamodel Integration Tasks
This document is specifically about integrating the new metamodel into master branch of hibernate-orm repository.
Tests that are known to fail on current metamodel branch are listed here.
Integration JIRA issue: HHH-8897
Repository: https://github.com/hibernate/hibernate-orm (branch: master)
Commit before integration: 1a87adca088c7b55f05726d25c9d6847dd5bb4e4
In order to minimize the impact of diverging functionality in master/metamodel branches, I took the following approach:
- create a branch of master (HHH-8897-replace-metamodel);
- delete the existing org.hibernate.metamodel package (main and test);
- org.hibernate.metamodel package (main and test) from the metamodel branch into into HHH-8897-replace-metamodel;
- make minimal code changes to accommodate the new metamodel.
This allows new/diverging functionality from the metamodel branch (outside of org.hibernate.metamodel) to be merged by the person most knowledgeable about that new/diverging functionality.
I did merge some functionality from metamodel branch that was required by org.hibernate.metamodel for compiling. In these cases, I made a guess and in some cases only merged some of the code for particular JIRA issues. It would be good for someone more familiar with the code to ensure that I did the right thing and in those cases where only parts were merged, to finish merging.
-
HHH-6054: Support for discriminator-based multi-tenancy (Steve)
-
HHH-7709 : change org.hibernate.type.ForeignKeyDirection to enum (Strong/Gail)
-
HHH-7736 : join subclass support (Strong/Gail)
-
[HHH-7556 : Clean up packages] (https://hibernate.atlassian.net/browse/HHH-7556) (Steve)
-
HHH-7491 : fix test failures caused by natural id cache access strategy is not exposed to the persister (Strong/Gail)
-
merged org.hibernate.id (why does IncrementGenerator still use o.h.mapping.Table???)
-
ReflectHelper.classForName() is still used in DefaultIdentifierGeneratorFactory.getIdentifierGeneratorClass() and add it to UUIDGenerator.configure(). Is that OK?
Still need to merge the following from metamodel (not a complete list):
- session and entity manager factory building
- make CacheRegion a service
- new tests added metamodel (not in master)
Misc. TODOs:
- @Embeddable classes need to be added to tests using BaseCoreFunctionalTestCase.getAnnotatedClasses(). Is that expected???
- check duplication between org/hibernate/engine/jdbc/connections/spi/JdbcConnectionAccess and org/hibernate/engine/jdbc/spi/JdbcConnectionAccess
- check duplication between hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/ and hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/metamodel
- MultiTableBulkIdStrategy is not supported because Mappings is not implemented for new metamodel
- Add support for new property generation.
- Add SingularAttributebinding.isLob (needed by AbstractEntityPersister)
- Add DerivedValue.getText( Dialect )
- Remove Configuration and MetadataImplementor from collection persister args
- Remove AbstractCollectionPersister.nodeName, elementNodeName, indexNodeName
- Remove obsolete dialects (old postgresql and oracle dialects)
- Remove obsolete TypeFactory methods and Type constructors
- Get rid of CollectionType.getElementClass(); should be able to get it from domain. Problem is that ClassLoaderService cannot handle primitive classes. Should it? I've temporarily added a map of primitive class names -> Class to MetadataImpl to deal with primitive arrays.
The following test failures probably require functionality to be merged from metamodel branch:
BeanValidation is not working (Hardy?):
- org.hibernate.test.annotations.beanvalidation.BeanValidationAutoTest
- org.hibernate.test.annotations.beanvalidation.BeanValidationGroupsTest
- org.hibernate.test.annotations.beanvalidation.BeanValidationProvidedFactoryTest
- org.hibernate.test.annotations.beanvalidation.DDLTest
- org.hibernate.test.annotations.beanvalidation.DDLWithoutCallbackTest
- org.hibernate.test.annotations.beanvalidation.HibernateTraversableResolverTest
- org.hibernate.test.c3p0.StatementCacheTest
Map key column is non-nullable; inserting null:
- org.hibernate.test.hql.BulkManipulationTest.testManyToManyBulkDeleteMultiTable Caused by: org.h2.jdbc.JdbcSQLException: NULL not allowed for column "RELATIONSHIP"; SQL statement: insert into Human_Human (human1, human2) values (?, ?) [90006-145]
Discriminators for joined subclasses has wrong type sometimes (related to addition of AvailableSettings.IMPLICIT_DISCRIMINATOR_COLUMNS_FOR_JOINED_SUBCLASS???) (Strong or Gail):
- org.hibernate.test.joinedsubclass.JoinedSubclassWithImplicitDiscriminatorTest.metadataAssertions()
- org.hibernate.test.joinedsubclass.JoinedSubclassWithExplicitDiscriminatorTest.metadataAssertions()
- org.hibernate.test.collection.lazynocascade.LazyAssociationNoCascadeTest
Fewer entity loads than expected in concurrent transactions:
- org.hibernate.test.tm.CMTTest.testConcurrent() java.lang.AssertionError: Expected :7 Actual :3
org.hibernate.test.cid.CompositeIdWithGeneratorTest fails in master because new metamodel cannot handle an IdentityGenerator w/ more than one column. (was changed to IdentifierGenerator on metamodel branch). org.hibernate.test.propertyref.basic.BasicPropertiesTest fails on master; not in metamodel branch.
New metamodel does not support a registered default tuplizer (IIRC, that should be added as a service):
- org.hibernate.test.dynamicentity.tuplizer2.ImprovedTuplizerDynamicEntityTest
NamingStrategy is not working:
- org.hibernate.test.namingstrategy.NamingStrategyTest.testDatabaseColumnNames
- org.hibernate.test.namingstrategy.NamingStrategyTest.testDatabaseTableNames
Stored procedures not working (not exported?):
- org.hibernate.test.sql.storedproc.StoredProcedureTest.testGetResultListTuple
- org.hibernate.test.sql.storedproc.StoredProcedureTest.testGetSingleResultTuple
- org.hibernate.test.sql.storedproc.StoredProcedureTest.testInParametersByName
- org.hibernate.test.sql.storedproc.StoredProcedureTest.testInParametersByPosition
Generated values are broken (not inserted and are non-nullable):
- org.hibernate.test.generated.DefaultGeneratedValueTest.testGeneration
- org.hibernate.test.generated.DefaultGeneratedValueTest > testUpdateTimestampGeneration
EntityNotFoundException is not thrown when it should be:
- org.hibernate.test.jpa.proxy.JPAProxyTest.testEjb3ProxyUsage
- org.hibernate.test.jpa.proxy.JPAProxyTest.testGetSemantics
The number of primary key column sources provided for a secondary table is not equal to the number of columns in the primary key:
- org.hibernate.test.annotations.JoinedSubclassTest
- org.hibernate.test.annotations.join.JoinTest
Embeddable type is not resolved when building EntityMetamodel:
- org.hibernate.test.annotations.embedded.many2one.EmbeddableWithMany2OneTest
Side affect due to BasicHibernateAnnotationsTest.testPolymorphism failure?
- org.hibernate.test.annotations.entity.BasicHibernateAnnotationsTest.testSerialized org.hibernate.exception.ConstraintViolationException Caused by: org.h2.jdbc.JdbcSQLException Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "FK_HF69MJ4YDYXUR8BHA09E6YUK4: PUBLIC.FOREST_NEAR FOREIGN KEY(FOREST_ID) REFERENCES PUBLIC.FOREST(ID)"; SQL statement: delete from Forest [23003-145]
@MapKeyClass is not supported yet.
- org.hibernate.test.annotations.target.TargetTest
SQL strings added more than once:
- org.hibernate.test.annotations.manytoonewithformula.ManyToOneWithFormulaTest (product.UK_product_idnf)
No support yet for referenced join columns unless they correspond with columns bound for an attribute binding.
- org.hibernate.test.annotations.onetoone.OneToOneTest
org.hibernate.test.annotations.derivedidentities.bidirectional.OneToOneWithDerivedIdentityTest > testCase FAILED org.hibernate.test.annotations.derivedidentities.bidirectional.OneToOneWithDerivedIdentityTest > testSelectWithDerivedId FAILEDjava.lang.NullPointerException at OneToOneWithDerivedIdentityTest.java:107
org.hibernate.test.annotations.derivedidentities.bidirectional.OneToOneWithDerivedIdentityTest > testInsertFooAndBarWithDerivedId FAILED java.lang.StackOverflowError
Schema name is wrong:
- org.hibernate.test.annotations.id.sequences.HibernateSequenceTest.testHibernateSequenceSchema Expected :OTHER_SCHEMA.hibernate_sequence Actual :hibernate_sequence
org.hibernate.test.annotations.lob.SerializableToBlobTypeTest.testTypeDefinition (Gail): Expected :org.hibernate.test.annotations.lob.ExplicitSerializableType Actual :org.hibernate.test.annotations.lob.ExplicitSerializable
org.hibernate.test.annotations.manytomany.ManyToManyMaxFetchDepth0Test > classMethod FAILED org.hibernate.testing.junit4.CallbackException Caused by: org.hibernate.cfg.NotYetImplementedException
org.hibernate.test.annotations.manytomany.ManyToManyTest > classMethod FAILED org.hibernate.testing.junit4.CallbackException Caused by: org.hibernate.cfg.NotYetImplementedException
Property accessor comparison of "field" with locale does not match, so tries to resolve a custom accessor:
- org.hibernate.test.locale.LocaleTest.testMetadataWithLocale
org.hibernate.test.any.AnyTypeTest.testJoinFetchOfAnAnyTypeAttribute FAILED java.lang.Exception Caused by: org.hibernate.QueryException at AnyTypeTest.java:81 Caused by: org.hibernate.QueryException at AnyTypeTest.java:81 Caused by: org.hibernate.QueryException: could not resolve property: data of: org.hibernate.test.any.Person [select p from org.hibernate.test.any.Person p join fetch p.data]
org.hibernate.test.events.CallbackTest > testCallbacks FAILED java.lang.AssertionError at CallbackTest.java:104 java.lang.AssertionError: observer not notified of creation
No 2nd-level cache for collection (i.e., CollectionPersister.hasCache() is false, but it should be true):
- org.hibernate.test.filter.DynamicFilterTest.testSecondLevelCachedCollectionsFiltering
Not-null property references a null or transient value: org.hibernate.test.cascade.circle.CascadeMergeToChildBeforeParentTest.testMergeData3Nodes org.hibernate.test.cascade.circle.CascadeMergeToChildBeforeParentTest.testMergeTransientChildBeforeTransientParent (org.hibernate.test.cascade.circle.Transport._org.hibernate.test.cascade.circle.Vehicle.transportsBackRef)
Table "HIBERNATE_UNIQUE_KEY" not found:
- org.hibernate.test.legacy.IJ2Test.testUnionSubclass
- org.hibernate.test.legacy.SQLFunctionsTest.testBlobClob
- org.hibernate.test.subselect.SubselectTest.testCustomColumnReadAndWrite
- org.hibernate.test.subselect.SubselectTest.testEntitySubselect
- org.hibernate.test.subclassfilter.UnionSubclassFilterTest.testFiltersWithUnionSubclass
- org.hibernate.test.propertyref.inheritence.union.UnionSubclassPropertyRefTest.testOneToOnePropertyRef
- org.hibernate.test.propertyref.inheritence.discrim.SubclassPropertyRefTest.testOneToOnePropertyRef
- org.hibernate.test.propertyref.basic.PropertyRefTest.testJoinFetchPropertyRef
- org.hibernate.test.propertyref.basic.PropertyRefTest.testNonLazyBagKeyPropertyRef
- org.hibernate.test.propertyref.basic.PropertyRefTest.testOneToOnePropertyRef
- org.hibernate.test.legacy.MapTest.testMap()
- org.hibernate.test.legacy.MapTest.testMapOneToOne()
org.hibernate.test.querycache.QueryCacheTest > testQueryCacheInvalidation FAILED java.lang.AssertionError at QueryCacheTest.java:219
org.hibernate.test.propertyref.basic.BasicPropertiesTest > testProperties FAILED java.lang.AssertionError at BasicPropertiesTest.java:67 java.lang.AssertionError: Expected :null Actual :foo1
SessionFactoryRegistry.INSTANCE still has a registration after removing the session factory and closing it (happens when running tests at the command line; does not happen when running test in Intellij):
- org.hibernate.serialization.SessionFactorySerializationTest
Something is initialized when it shouldn't be (Gail):
- org.hibernate.test.onetoone.formula.OneToOneFormulaTest.testOneToOneEmbeddedCompositeKey
An entity should be a HibernateProxy, but it is not:
- org.hibernate.test.immutable.ImmutableTest.testChangeImmutableEntityProxyToModifiable
- org.hibernate.test.immutable.ImmutableTest.testChangeImmutableEntityToModifiable
org.hibernate.test.ops.SaveOrUpdateTest > testSaveOrUpdateGotWithMutableProp FAILED java.lang.AssertionError at SaveOrUpdateTest.java:537 there is a comment that if there is no 2nd-level cache, it will fail; is that why?
SecondLevelCacheStatistics is null:
- org.hibernate.test.cache.ehcache.EhCacheRegionTest
Entity mappings in hibernate.cfg.xml not found:
- org.hibernate.test.cache.HibernateCacheTest
Tests that extend BaseUnitTestCase (and not BaseCoreFunctionalTestCase) that explicitly build Configuration (requires merging changes to testing code from metamodel branch). For now, they throw NotYetImplementedException:
Configuration now wraps metamodel, so these need re-investigated.
- org.hibernate.test.annotations.access.xml.XmlAccessTest
- org.hibernate.test.annotations.id.JoinColumnOverrideTest
- org.hibernate.test.annotations.id.sequences.JoinColumnOverrideTest
- org.hibernate.test.nationalized.SimpleNationalizedTest
- org.hibernate.test.naturalid.inheritance.spread.SpreadNaturalIdTest
- org.hibernate.test.type.AttributeConverterTest
Tests that don't support new metamodel yet (only use configuration()):
- other tests in envers and infinispan
Don't know why the following are passing with new metamodel (they are marked @FailureExpected in both metamodel and master branches):
- org.hibernate.test.collection.set.PersistentSetNonLazyTest.testLoadChildCheckParentContainsChildCache
Don't know why the following are passing after integration into master (they are marked @FailureExpectedWithNewMetamodel in metamodel branch):
- org.hibernate.test.instrument.runtime.JavassistInstrumentationTest.testLazy()
- org.hibernate.test.instrument.runtime.JavassistInstrumentationTest.testLazyManyToOne
- org.hibernate.test.instrument.runtime.JavassistInstrumentationTest.testManyToOneProxy
- org.hibernate.test.instrument.runtime.JavassistInstrumentationTest.testSharedPKOneToOne
Envers integration tests are failing:
- org.hibernate.envers.test.integration.merge.AddDelTest
- org/hibernate.envers.test.integration.tools.SchemaExportTest
- org/hibernate.envers.test.integration.proxy.QueryingWithProxyObjectTest
Notes (Steve)
- parts of PluralAttributeBinding (elements, key, etc) need to expose org.hibernate.metamodel.spi.source.MetaAttributeContext; see org.hibernate.test.legacy.NonReflectiveBinderTest. Maybe good idea to introduce a contract for things that are or have a MetaAttributeContext
- org.hibernate.test.multitenancy.schema.SchemaBasedMultiTenancyTest (and subclasses) are completely commented out atm.
- org.hibernate.test.stats.StatsTest#testCollectionFetchVsLoad
- org.hibernate.test.annotations.access.jpa.AccessMappingTest#testAccessOnClassAndId illustrates what i think is a problem in the binding code. The code in question is org.hibernate.metamodel.internal.source.annotations.entity.ConfiguredClass#checkExplicitJpaAttributeAccessAnnotationPlacedCorrectly; it errors if @Access(AccessType.PROPERTY) is places on a getter on a class which also states @Access(AccessType.PROPERTY) (and vice versa). Seems to me this should just warn the user.
- I saw a few failures because metamodel does not seem to be able to find @Embeddables for @Embedded
- Need to make sure we can force the Dialect to use in SchemaManagementTool delegates, rather than the (if set) Dialect on JdbcEnvironment associated with the Database. Or (better yet?) allow forcing the JdbcEnvironment used on Database.
- Composite Jandex support currently assumes all/nothing. Meaning we assume that an incoming Jandex index holds all class/annotations. This causes some problems with EntityManagerFactoryBuilder because it partially builds a Jandex for "discovered" classes though not mapped or listed classes. INitially it had done this to support class enhancement. We just need to vberify this all works smoothly.