2016-02-10 3 views
1

Мое приложение с Hibernate + spring не может создать DDL. Вот мои конфигурации.Spring MVC + hibernate не может создать DDL

Мой WebApp.xml является enter image description here

И Мои Сущности в пакете org.ex.doqi.domain

enter image description here

WAS является wildfly 9 и начать журнал

17:21:05,667 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "ex11-1.0-SNAPSHOT.war" (runtime-name: "ex11-1.0-SNAPSHOT.war") 
17:21:13,825 WARN [org.jboss.as.ee] (MSC service thread 1-4) WFLYEE0007: Not installing optional component org.springframework.http.server.ServletServerHttpAsyncRequestControl due to an exception (enable DEBUG log level to see the cause) 
17:21:13,831 WARN [org.jboss.as.ee] (MSC service thread 1-4) WFLYEE0007: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to an exception (enable DEBUG log level to see the cause) 
17:21:14,103 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0005: Deploying non-JDBC-compliant driver class org.mariadb.jdbc.Driver (version 1.2) 
17:21:14,104 WARN [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0013: Deployment deployment "ex11-1.0-SNAPSHOT.war" contains CDI annotations but no bean archive was not found. (No beans.xml nor class with bean defining annotations) 
17:21:14,171 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-1) WFLYJCA0018: Started Driver service with driver-name = ex11-1.0-SNAPSHOT.war_org.mariadb.jdbc.Driver_1_2 
17:21:14,494 INFO [io.undertow.servlet] (ServerService Thread Pool -- 68) No Spring WebApplicationInitializer types detected on classpath 
17:21:14,528 INFO [io.undertow.servlet] (ServerService Thread Pool -- 68) Initializing Spring root WebApplicationContext 
17:21:14,534 INFO [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 68) Root WebApplicationContext: initialization started 
17:21:14,789 INFO [org.springframework.web.context.support.XmlWebApplicationContext] (ServerService Thread Pool -- 68) Refreshing Root WebApplicationContext: startup date [Wed Feb 10 17:21:14 KST 2016]; root of context hierarchy 
17:21:15,365 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (ServerService Thread Pool -- 68) Loading XML bean definitions from class path resource [appConfig.xml] 
17:21:16,197 INFO [org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor] (ServerService Thread Pool -- 68) JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 
17:21:16,536 INFO [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] (ServerService Thread Pool -- 68) Building JPA container EntityManagerFactory for persistence unit 'jpa11' 
17:21:16,548 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 68) HHH000204: Processing PersistenceUnitInfo [ 
    name: jpa11 
    ...] 
17:21:16,725 INFO [org.hibernate.Version] (ServerService Thread Pool -- 68) HHH000412: Hibernate Core {4.3.11.Final} 
17:21:16,735 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 68) HHH000206: hibernate.properties not found 
17:21:16,740 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 68) HHH000021: Bytecode provider name : javassist 
17:21:17,002 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 68) HCANN000001: Hibernate Commons Annotations {4.0.5.Final} 
17:21:17,600 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 68) HHH000400: Using dialect: org.hibernate.dialect.MySQL5InnoDBDialect 
17:21:17,920 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 68) HHH000397: Using ASTQueryTranslatorFactory 
17:21:17,981 INFO [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 68) HV000001: Hibernate Validator 5.1.3.Final 
17:21:18,917 INFO [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 68) Root WebApplicationContext: initialization completed in 4383 ms 

Вопрос

Даже если опция «hibernate.hdm2ddl.auto» верна, почему весенний контекст не может создать DDL?

+0

может быть проблемой «вы не упомянули классы ресурсов в xml-файле», – Musaddique

ответ

1

Недвижимость hibernate.hbm2ddl.auto, а не hibernate.hdm2ddl.auto.

Заменить д с б в hdm2ddl.

От documentation -

hibernate.hbm2ddl.auto 

Автоматически проверяет или экспорта схемы DDL в базу данных, когда SessionFactory создается. С помощью create-drop схема базы данных будет отбрасываться, если SessionFactory закрывается явно. например проверить | обновление | создать | create-drop