Skip to content

Metamodel Integration Tasks

gbadner edited this page Jan 30, 2014 · 40 revisions

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.

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

key-many-to-one on-delete="..." not supported (need to rebuild xsd) (introduced by HHH-7807) (Steve or Brett?):

  • org.hibernate.test.hql.BulkManipulationTest
  • org.hibernate.test.idprops.IdentifierPropertyReferencesTest
  • org.hibernate.test.immutable.ImmutableTest
  • org.hibernate.test.keymanytoone.bidir.component.EagerKeyManyToOneTest
  • org.hibernate.test.keymanytoone.bidir.component.LazyKeyManyToOneTest
  • org.hibernate.test.keymanytoone.bidir.embedded.KeyManyToOneTest
  • org.hibernate.test.keymanytoone.bidir.ondelete.KeyManyToOneCascadeDeleteTest
  • org.hibernate.test.keymanytoone.unidir.ondelete.KeyManyToOneCascadeDeleteTest
  • org.hibernate.test.loadplans.process.NonEncapsulatedCompositeIdResultSetProcessorTest
  • org.hibernate.test.loadplans.walking.KeyManyToOneWalkingTest
  • org.hibernate.test.onetoone.formula.OneToOneFormulaTest

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

EntityMode.MAP not working:

  • org.hibernate.test.entitymode.map.basic.DynamicClassTest
  • org.hibernate.test.entitymode.map.subclass.SubclassDynamicMapTest
  • org.hibernate.test.legacy.MapTest
  • org.hibernate.test.onetoone.nopojo.DynamicMapOneToOneTest
  • org.hibernate.test.tm.CMTTest

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

Default index type when @MapKeyColumn is used:

  • org.hibernate.test.collection.map.PersistentMapTest

Calling org.hibernate.type.EntityType.determineAssociatedEntityClass() too soon (Gail):

  • org.hibernate.test.typedonetoone.TypedOneToOneTest
  • org.hibernate.test.onetoone.singletable.DiscrimSubclassOneToOneTest
  • org.hibernate.test.onetoone.joined.JoinedSubclassOneToOneTest
  • org.hibernate.test.typedmanytoone.TypedManyToOneTest
  • org.hibernate.test.entityname.EntityNameFromSubClassTest Caused by: org.hibernate.HibernateException: SessionFactory for type scoping not yet known at org.hibernate.type.TypeFactory$TypeScopeImpl.resolveFactory(TypeFactory.java:79) at org.hibernate.type.EntityType.determineAssociatedEntityClass(EntityType.java:278)

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

Fail because of a Lob?

  • org.hibernate.test.annotations.entity.BasicHibernateAnnotationsTest.testPolymorphism

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]

Attributes of org.hibernate.annotations.Entity annotation not processed:

  • org.hibernate.test.annotations.entity.NewCustomEntityMappingAnnotationsTest.testSameMappingValues (dynamic insert is not detected using @org.hibernate.annotations.Entity(dynamicInsert = true))
  • org.hibernate.test.annotations.persister.PersisterTest (persister not processed using @org.hibernate.annotations.Entity( persister = "org.hibernate.persister.entity.SingleTableEntityPersister" ) )
  • org.hibernate.test.annotations.polymorphism.PolymorphismTest.testPolymorphism (@org.hibernate.annotations.Entity(polymorphism = PolymorphismType.EXPLICIT) not processed)

@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

org.hibernate.test.constraint.ConstraintTest > classMethod FAILED org.hibernate.testing.junit4.CallbackException Caused by: java.lang.IllegalArgumentException String collection element type is not resolved

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 (Brett):

  • 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.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

Something is initialized when it shouldn't be (Gail):

  • org.hibernate.test.propertyref.component.partial.PartialComponentPropertyRefTest.testComponentPropertyRef
  • org.hibernate.test.propertyref.component.complete.CompleteComponentPropertyRefTest.testComponentPropertyRef

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:

  • org.hibernate.test.annotations.access.xml.XmlAccessTest
  • org.hibernate.test.annotations.id.JoinColumnOverrideTest
  • org.hibernate.test.annotations.id.sequences.JoinColumnOverrideTest
  • org.hibernate.test.annotations.uniqueconstraint.UniqueConstraintValidationTest
  • org.hibernate.test.cfg.cache.CacheConfigurationTest
  • org.hibernate.test.nationalized.SimpleNationalizedTest
  • org.hibernate.test.naturalid.inheritance.spread.SpreadNaturalIdTest
  • org.hibernate.test.type.AttributeConverterTest
  • org.hibernate.serialization.SessionFactorySerializationTest

Tests that don't support new metamodel yet (only use configuration()):

  • org.hibernate.test.constraint.ConstraintTest
  • 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