[hibernate-dev] Metamodel tests

Steve Ebersole steve at hibernate.org
Sun Jul 29 18:11:00 EDT 2012


For what its worth... I tried adding this for y'all before I left, but 
it actually does not at all affect the tests.  Not sure what tests you 
saw failing because the id sequence/table is not there, but I tried a 
few tests that use sequences and they all fail trying to build the 
MetaData object.  If tests are failing because the sequences do not get 
exported to the database, the failures would be well after than point 
trying to issues SQL against the database.

Anyway I pushed the code that adds this to SchemaExport:
https://github.com/hibernate/hibernate-orm/commit/b2ef3b67b2cb8a2e134bf08e267c29e78335650b

I'll hook in the new schema management tool service when i get back.


On 07/29/2012 03:38 PM, Steve Ebersole wrote:
> Just a reminder that I am on vacation this next week.
>
> If you want this in the meantime, you just need to alter the
> org.hibernate.metamodel.spi.relational.Database#generateSchemaCreationScript
> and
> org.hibernate.metamodel.spi.relational.Database#generateDropSchemaScript
> methods.   There is a
> org.hibernate.metamodel.spi.relational.Schema#sequences collection, but
> they wont be populated using this
> generateSchemaCreationScript/generateDropSchemaScript approach, so in
> there you will need a way to find all persistent identifier generators
> (please DO NOT collect them on Database/Schema) and handle it.
>
> Those methods will go away when I fully hook up the schema management
> tools (they are only used from SchemaExport) so don't worry about
> breaking the schema management tool code.  And the new code will add
> sequences and tables from persistent identifier generator as we discover
> them (not coded yet)
>
> Or just wait till I get back..
>
> On 07/29/2012 01:35 PM, Steve Ebersole wrote:
>>
>> Yep I have not hooked my new schema management tool stuff into
>> metamodel creation yet.
>>
>> On Jul 29, 2012 1:24 PM, "Strong Liu" <stliu at hibernate.org
>> <mailto:stliu at hibernate.org>> wrote:
>>
>>     btw, some tests are failing due to the identifier generator
>>     required sequence are not created.
>>
>>     org.hibernate.id.PersistentIdentifierGenerator#sqlCreateStrings is
>>     never get called
>>
>>     (yes, i see there is
>>     a org.hibernate.id.SequenceGenerator#registerExportables)
>>
>>
>>     and others are failing with stacktrace:
>>
>>     javax.persistence.PersistenceException: [PersistenceUnit: FlushAndTransactionTest] Unable to build Hibernate SessionFactory
>>     	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:973)
>>     	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildEntityManagerFactory(EntityManagerFactoryBuilderImpl.java:782)
>>     	at org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase.buildEntityManagerFactory(BaseEntityManagerFunctionalTestCase.java:93)
>>     	at sun.reflect.GeneratedMethodAccessor26.invoke(Unknown Source)
>>     	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>     	at java.lang.reflect.Method.invoke(Method.java:601)
>>     	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>>     	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>     	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>>     	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
>>     	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
>>     	at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62)
>>     Caused by: org.hibernate.MappingException: Could not instantiate id generator [entity-name=org.hibernate.jpa.test.transaction.Book]
>>     	at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:123)
>>     	at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:219)
>>     	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:359)
>>     	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1748)
>>     	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildEntityManagerFactory(EntityManagerFactoryBuilderImpl.java:779)
>>     	... 10 more
>>     Caused by: java.lang.NullPointerException
>>     	at org.hibernate.id.enhanced.TableGenerator.determineGeneratorTableName(TableGenerator.java:353)
>>     	at org.hibernate.id.enhanced.TableGenerator.configure(TableGenerator.java:299)
>>     	at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:117)
>>     	... 14 more
>>
>>
>>
>>     On Jul 30, 2012, at 1:34 AM, Strong Liu <stliu at hibernate.org
>>     <mailto:stliu at hibernate.org>> wrote:
>>
>>>     I was not aware of that, the root issue is
>>>     "org.hibernate.metamodel.internal.source.annotations.attribute.Column#name"
>>>     has a default empty string value.
>>>
>>>
>>>     On Jul 30, 2012, at 1:30 AM, Steve Ebersole <steve at hibernate.org
>>>     <mailto:steve at hibernate.org>> wrote:
>>>
>>>>     Hadn't we all agreed though that the convention was for sources
>>>>     to return null and not empty strings?
>>>>
>>>>     On Jul 29, 2012 11:11 AM, "Strong Liu" <stliu at hibernate.org
>>>>     <mailto:stliu at hibernate.org>> wrote:
>>>>
>>>>         https://hibernate.onjira.com/browse/HHH-7480
>>>>
>>>>         don't know which change caused this, but it is fixed now
>>>>
>>>>         On Jul 28, 2012, at 10:27 AM, Steve Ebersole
>>>>         <steve at hibernate.org <mailto:steve at hibernate.org>> wrote:
>>>>
>>>>>         Not sure if the expectation at this point is that all tests
>>>>>         on the
>>>>>         metamodel branch pass when
>>>>>         hibernate.test.new_metadata_mappings is set
>>>>>         to true or not.  That was supposed to be the idea with the new
>>>>>         @FailureExpectedWithNewMetamodel annotation which I see is
>>>>>         in place now.
>>>>>          But I am still seeing failures.  Yes I have local changes
>>>>>         here, but
>>>>>         there is no way my changes can be causing these:
>>>>>
>>>>>
>>>>>         Test
>>>>>         org.hibernate.metamodel.internal.source.annotations.entity.TableNameTest
>>>>>
>>>>>         FAILED
>>>>>         Test
>>>>>         org.hibernate.metamodel.internal.source.annotations.entity.AccessBindingTest
>>>>>
>>>>>         FAILED
>>>>>         Test
>>>>>         org.hibernate.metamodel.internal.source.annotations.entity.InheritanceBindingTest
>>>>>
>>>>>         FAILED
>>>>>
>>>>>
>>>>>         The failures in all cases is from attempt to bind the
>>>>>         discriminator from
>>>>>         annotations.  As far as I can tell the cause is that
>>>>>         annotation sources
>>>>>         are returning empty string for that column name rather than
>>>>>         null.
>>>>>
>>>>>         But either way, nothing to do with my changes.  So I am
>>>>>         going to go
>>>>>         ahead and push my changes
>>>>>
>>>>>
>>>>>
>>>>>         --
>>>>>         steve at hibernate.org <mailto:steve at hibernate.org>
>>>>>         http://hibernate.org <http://hibernate.org/>
>>>>>         _______________________________________________
>>>>>         hibernate-dev mailing list
>>>>>         hibernate-dev at lists.jboss.org
>>>>>         <mailto:hibernate-dev at lists.jboss.org>
>>>>>         https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>
>>>>         -------------------------
>>>>         Best Regards,
>>>>
>>>>         Strong Liu <stliu at hibernate.org <http://hibernate.org/>>
>>>>         http://about.me/stliu/bio
>>>>
>>>
>>>     -------------------------
>>>     Best Regards,
>>>
>>>     Strong Liu <stliu at hibernate.org <http://hibernate.org/>>
>>>     http://about.me/stliu/bio
>>>
>>
>>     -------------------------
>>     Best Regards,
>>
>>     Strong Liu <stliu at hibernate.org <http://hibernate.org/>>
>>     http://about.me/stliu/bio
>>
>
>
> --
> steve at hibernate.org
> http://hibernate.org
>

-- 
steve at hibernate.org
http://hibernate.org


More information about the hibernate-dev mailing list