hbm2ddl.auto = validate is not validating tables created when using plain SQL and @CreateSchema
FagnerMartinsBrack opened this issue · comments
When using @CreateSchema
and hbm2ddl.auto = validate
the CREATE TABLE
statement does not work.
It throws:
19:11:38,106 INFO [java.sql.DatabaseMetaData] (MSC service thread 1-7) HHH000262: Table not found: table_name
19:11:38,108 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.persistenceunit."44fdf497-81e8-42cf-b964-0e5dc9347ffe.war#PersistenceUnit": org.jboss.msc.service.StartException in service jboss.persistenceunit."44fdf497-81e8-42cf-b964-0e5dc9347ffe.war#PersistenceUnit": Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_11]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_11]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_11]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: PersistenceUnit] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
... 3 more
Caused by: org.hibernate.HibernateException: Missing table: table_name
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1265)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:155)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:460)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
... 9 more
Using JBoss AS 7.1.1.Final (managed).
I suppose this could be a bug with the persistence-api, am I right?
I think hbm2ddl.auto = validate kicks in before the extension itself, so the schema is not there yet... Not sure if that's a bug, because validation happens during deployment and extension creates schema when the test is about to be executed.
validation happens during deployment and extension creates schema when the test is about to be executed
Is this possible to be corrected somehow? Quite a powerfull feature we've got here (hbm2ddl validation).
For the moment I think we can re-use hibernate validation within the extension itself (which will be configurable not through hbm2ddl though). But maybe there is another way... Can you create feature request in JIRA? I will investigate.
Can you create feature request in JIRA
Er... I found this repo on github so I thought here is where you were tracking issues. How do I create a feature request in JIRA? Is there any guide? You should post that in the main page so new githubbers would know where to go first for issues.
My bad :) I assumed you know jboss community forums, irc and jira.
So here's an example of a feature request for APE. If you could create similar one you will be notified about the progress.
Many thanks! And welcome in the community.
Thanks.
Man that JIRA is too verbose, didn't like it... =(
Hehe it is, a bit, but it's also very powerful :) We want to have all ARQ projects under control. It's de facto the tool of choice for all jboss projects so let's stick to that.
Closing the "issue" as it's anyway reported in JIRA.