I'm facing issues with spring and hibernate5 beta2 - I get a duplicate foreignkey exception. I spoke with the hibernate team and they proved that when using only hibernate api then this exception does not occur. I tried to build against the latest snapshot but I get the same exception - only when using spring-orm. Here's my repository: https://github.com/paranoiabla/hibernate-hsql-issue
We're not doing anything unusual in that area, as far as I'm aware. I'm surprised that a foreign key exception would only arise when using it with Spring... Does a plain non-Spring Hibernate EntityManager setup work there? Since even if it works with a native Hibernate Session, it could still be a bug in Hibernate's EntityManager implementation... That said, if it is indeed a Spring-only problem, I'll have a look at it ASAP.
thanks for your feedback. Yes, indeed, this appears to happen only when we have spring involved. The sample project contains a test-case from Steve Ebersole from hibernate which works fine (no spring involved there).
Looking at the test case, it seems that the problem isn't even in the Session or EntityManager but rather in the SchemaUpdate tool? Even more surprising that the presence of Spring makes a difference there. I'll see what I can find out...
To me it doesn't feel like Spring being involved causing the issue here but Hibernate not correctly analyzing that schema to update during multiple EntityManagerFactory creations which easily appear in Spring based integration tests. We're just using hibernate.hbm2ddl.auto set to update, so nothing really fancy here.