[hibernate-dev] Trying Hibernate 5.0.0.Beta2

Petar Tahchiev paranoiabla at gmail.com
Thu May 14 12:30:06 EDT 2015


Hi Steve,

your test indeed works fine - I logged here
https://jira.spring.io/browse/SPR-11694 so that the spring guys will have a
look, but I don't think spring is doing any magic on the foreign keys.
Juergen Hoeller from spring proposed it might be a bug in Hibernate's
EntityManager implementation.

I wish we could find out where the problem, but I'm not really that good to
investigate further.

2015-05-14 19:27 GMT+03:00 Steve Ebersole <steve at hibernate.org>:

> No word on the new test case I take it?
>
> WRT the HHH000072 logged warnings, like i said the warning is inocuous.
> But I did correct it: https://hibernate.atlassian.net/browse/HHH-9797
>
> On Wed, May 13, 2015 at 3:52 PM, Steve Ebersole <steve at hibernate.org>
> wrote:
>
>> Nope.  Well, specifically yes your test fails as is.  But since you did
>> not simplify your environment, I took that opportunity and simplified it.
>> So I sent you a PR that adds a new test using your model and successfully
>> running an schema update.  The only difference is that my test does not
>> have all this unnecessary Spring BS in the mix.
>>
>> So no, I do not thinking this warrants a Hibernate Jira.  Until you can
>> simplify this to happen with just Hibernate in the picture.
>>
>> On Wed, May 13, 2015 at 12:59 PM, Petar Tahchiev <paranoiabla at gmail.com>
>> wrote:
>>
>>> Any luck on reproducing this?
>>>
>>> 2015-05-05 16:17 GMT+03:00 Steve Ebersole <steve at hibernate.org>:
>>>
>>>> Petar, I have just been focusing on other things the past 3 days or
>>>> so.  Chill :)
>>>>
>>>> I will look at this this week.  If you happen to have a chance to debug
>>>> it any further by then, that would rock.  FWIW, I do not think it is in any
>>>> way related to the duplicate secondary table warnings.  Those are
>>>> completely harmless I believe.  The FK naming logic has changed quite a bit
>>>> from pre-5.0 versions, my guess is that the issue lies there.  That or in
>>>> the logic to read existing FKs.
>>>>
>>>> On Tue, May 5, 2015 at 3:19 AM, Petar Tahchiev <paranoiabla at gmail.com>
>>>> wrote:
>>>>
>>>>> Any of you have seen this issue? Shall I open a ticket?
>>>>>
>>>>> 2015-05-04 0:03 GMT+03:00 Petar Tahchiev <paranoiabla at gmail.com>:
>>>>>
>>>>> > Hi guys,
>>>>> >
>>>>> > I finally managed to reproduce it - here's a small application that
>>>>> will
>>>>> > generate the provided exception:
>>>>> >
>>>>> > https://github.com/paranoiabla/hibernate-hsql-issue
>>>>> >
>>>>> > Please notice that it works fine with Hibernate 4.3.x  I think it
>>>>> has to
>>>>> > do something with the CommerceCustomerModel - If I remove it or
>>>>> remove the
>>>>> > collection of payment infos that is inside of it, it all starts to
>>>>> work
>>>>> > fine.
>>>>> >
>>>>> > Please have a look and thanks a lot for your efforts :)
>>>>> >
>>>>> >
>>>>> >
>>>>> >
>>>>> > 2015-05-03 1:13 GMT+03:00 Petar Tahchiev <paranoiabla at gmail.com>:
>>>>> >
>>>>> >> Hi guys,
>>>>> >>
>>>>> >> I just tried hibernate 5.0 beta2 and here's my observations. First
>>>>> of all
>>>>> >> the foreign key problems I had before seems to be resolved, however
>>>>> I see
>>>>> >> the following error when executing tests with HSQL:
>>>>> >>
>>>>> >>
>>>>> >> Caused by: org.springframework.beans.factory.BeanCreationException:
>>>>> Error
>>>>> >> creating bean with name 'defaultEntityManagerFactory' defined in
>>>>> class path
>>>>> >> resource
>>>>> [com/nemesis/platform/core/config/PlatformCoreTestConfig.class]:
>>>>> >> Invocation of init method failed; nested exception is
>>>>> >> javax.persistence.PersistenceException: [PersistenceUnit: default]
>>>>> Unable
>>>>> >> to build Hibernate SessionFactory
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:304)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:300)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1011)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:802)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:521)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.boot.SpringApplication.refresh(SpringApplication.java:687)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.boot.SpringApplication.run(SpringApplication.java:321)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.boot.test.SpringApplicationContextLoader.loadContext(SpringApplicationContextLoader.java:100)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
>>>>> >>     ... 36 more
>>>>> >> Caused by: javax.persistence.PersistenceException: [PersistenceUnit:
>>>>> >> default] Unable to build Hibernate SessionFactory
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:874)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:802)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:60)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:343)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:318)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
>>>>> >>     at
>>>>> >>
>>>>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
>>>>> >>     ... 50 more
>>>>> >> Caused by: org.hibernate.tool.schema.spi.SchemaManagementException:
>>>>> >> Unable to execute schema management to JDBC target [alter table
>>>>> >> payment_info add constraint FKs9wud9nve6s9cbot5p4548jyh foreign key
>>>>> >> (user_pk) references principal]
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.schema.internal.TargetDatabaseImpl.accept(TargetDatabaseImpl.java:75)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlString(SchemaMigratorImpl.java:349)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.schema.internal.SchemaMigratorImpl.applySqlStrings(SchemaMigratorImpl.java:338)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.schema.internal.SchemaMigratorImpl.applyForeignKeys(SchemaMigratorImpl.java:303)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigrationToTargets(SchemaMigratorImpl.java:135)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.schema.internal.SchemaMigratorImpl.doMigration(SchemaMigratorImpl.java:76)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:146)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:114)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:461)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:799)
>>>>> >>     ... 55 more
>>>>> >> Caused by: java.sql.SQLSyntaxErrorException: object name already
>>>>> exists:
>>>>> >> FKS9WUD9NVE6S9CBOT5P4548JYH in statement [alter table payment_info
>>>>> add
>>>>> >> constraint FKs9wud9nve6s9cbot5p4548jyh foreign key (user_pk)
>>>>> references
>>>>> >> principal]
>>>>> >>     at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
>>>>> >>     at org.hsqldb.jdbc.JDBCUtil.sqlException(Unknown Source)
>>>>> >>     at org.hsqldb.jdbc.JDBCStatement.fetchResult(Unknown Source)
>>>>> >>     at org.hsqldb.jdbc.JDBCStatement.executeUpdate(Unknown Source)
>>>>> >>     at
>>>>> >>
>>>>> com.zaxxer.hikari.proxy.StatementProxy.executeUpdate(StatementProxy.java:108)
>>>>> >>     at
>>>>> >>
>>>>> com.zaxxer.hikari.proxy.StatementJavassistProxy.executeUpdate(StatementJavassistProxy.java)
>>>>> >>     at
>>>>> >>
>>>>> org.hibernate.tool.schema.internal.TargetDatabaseImpl.accept(TargetDatabaseImpl.java:72)
>>>>> >>     ... 65 more
>>>>> >> Caused by: org.hsqldb.HsqlException: object name already exists:
>>>>> >> FKS9WUD9NVE6S9CBOT5P4548JYH
>>>>> >>     at org.hsqldb.error.Error.error(Unknown Source)
>>>>> >>     at org.hsqldb.error.Error.error(Unknown Source)
>>>>> >>     at org.hsqldb.SchemaObjectSet.checkAdd(Unknown Source)
>>>>> >>     at org.hsqldb.SchemaManager.checkSchemaObjectNotExists(Unknown
>>>>> Source)
>>>>> >>     at org.hsqldb.TableWorks.checkCreateForeignKey(Unknown Source)
>>>>> >>     at org.hsqldb.TableWorks.addForeignKey(Unknown Source)
>>>>> >>     at org.hsqldb.StatementSchema.getResult(Unknown Source)
>>>>> >>     at org.hsqldb.StatementSchema.execute(Unknown Source)
>>>>> >>     at org.hsqldb.Session.executeCompiledStatement(Unknown Source)
>>>>> >>     at org.hsqldb.Session.executeDirectStatement(Unknown Source)
>>>>> >>     at org.hsqldb.Session.execute(Unknown Source)
>>>>> >>     ... 70 more
>>>>> >>
>>>>> >>
>>>>> >> When running it with mysql it doesn't show this error (very
>>>>> strange) so I
>>>>> >> tried to export the schema to sql file and I can see only one
>>>>> foregin key
>>>>> >> declaration:
>>>>> >>
>>>>> >>     alter table payment_info
>>>>> >>         add constraint FKs9wud9nve6s9cbot5p4548jyh
>>>>> >>         foreign key (user_pk)
>>>>> >>         references principal (pk);
>>>>> >>
>>>>> >> Notice that this time it is lowercase. I'm trying to debug the hsql
>>>>> but
>>>>> >> it is very hard as it doesn't stop on any of the breakpoints I add.
>>>>> If any
>>>>> >> of you have an idea what might be causing it, please share your
>>>>> thoughts,
>>>>> >> if not I'll let you know how I progress.
>>>>> >>
>>>>> >> I wonder if it could be related to the duplicate joins warnings I
>>>>> see:
>>>>> >> WARN : HHH000072: Duplicate joins for class:
>>>>> >> com.nemesis.platform.core.model.media.MediaModel
>>>>> >> WARN : HHH000072: Duplicate joins for class:
>>>>> >>
>>>>> com.nemesis.platform.module.commerce.core.model.order.TerritoryDeliveryModeValueModel
>>>>> >> WARN : HHH000072: Duplicate joins for class:
>>>>> >> com.nemesis.platform.core.model.cms.AbstractPageModel
>>>>> >> WARN : HHH000072: Duplicate joins for class:
>>>>> >> com.nemesis.platform.core.model.cms.EmailPageModel
>>>>> >> WARN : HHH000072: Duplicate joins for class:
>>>>> >> com.nemesis.platform.core.model.cms.CategoryPageModel
>>>>> >> .....
>>>>> >>
>>>>> >> --
>>>>> >> Regards, Petar!
>>>>> >> Karlovo, Bulgaria.
>>>>> >> ---
>>>>> >> Public PGP Key at:
>>>>> >>
>>>>> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
>>>>> >> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>>>>> >>
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > Regards, Petar!
>>>>> > Karlovo, Bulgaria.
>>>>> > ---
>>>>> > Public PGP Key at:
>>>>> >
>>>>> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
>>>>> > Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards, Petar!
>>>>> Karlovo, Bulgaria.
>>>>> ---
>>>>> Public PGP Key at:
>>>>>
>>>>> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
>>>>> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>>>>> _______________________________________________
>>>>> hibernate-dev mailing list
>>>>> hibernate-dev at lists.jboss.org
>>>>> https://lists.jboss.org/mailman/listinfo/hibernate-dev
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Regards, Petar!
>>> Karlovo, Bulgaria.
>>> ---
>>> Public PGP Key at:
>>> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
>>> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611
>>>
>>
>>
>


-- 
Regards, Petar!
Karlovo, Bulgaria.
---
Public PGP Key at:
https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611


More information about the hibernate-dev mailing list