java—如何在jboss部署期间重写hibernate.hbm2ddl.auto属性而不更改代码

v09wglhw  于 2021-06-27  发布在  Java
关注(0)|答案(0)|浏览(210)

环境-在下面的配置(windows10/ubuntu)中观察到相同的错误
jdk7、jboss7.2.0、,
openjdk8、wildfly8
openjdk11、wildfly18
错误stack:-

ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 52) MSC00001: Failed to start service jboss.persistenceunit."gazelle-gss.ear/gazelle-atna-ejb.jar#gazelle-gss-PersistenceUnit": org.jboss.msc.service.StartException in service jboss.persistenceunit."gazelle-gss.ear/gazelle-atna-ejb.jar#gazelle-gss-PersistenceUnit": javax.persistence.PersistenceException: [PersistenceUnit: gazelle-gss-PersistenceUnit] Unable to build EntityManagerFactory
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:103)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_80]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_80]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_80]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: gazelle-gss-PersistenceUnit] Unable to build EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:925)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:900)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:200)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)
at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)
... 4 more
Caused by: org.hibernate.HibernateException: Missing table: atna_instruction_instance
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1304)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:175)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:512)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1799)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915)
... 9 more

源代码-https://gitlab.inria.fr/gazelle/applications/mixed/gazelle-atna/-/tree/masteranalysis- pom.xml文件有以下条目-<hibernate.hbm2ddl.auto>验证</hibernate.hbm2ddl.auto>
persistence.xml文件有以下条目-property name=“hibernate.hbm2ddl.auto”value=“${hibernate.hbm2ddl.auto}”/>
因此,在经历了一些线程之后,得到了这样的提示:属性“hibernate.hbm2ddl.auto”应该有值“create”,以便自动创建所需的实体。
尝试了在standalone.xml中设置属性的选项1,但应用程序只考虑默认值“validate”。ref(如何在不使用persistence.xml的wildfly中设置hibernate.hbm2ddl.auto部署)

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题