2015-02-05 5 views
3

jpa + hibernate를 사용하는 프로젝트가 있습니다. persistence.xml 파일을 가지고 있고 데이터베이스에 테이블을 자동으로 만들길 원합니다. 모든 속성을 올바르게 지정했습니다. 로그에 모든 sql 문이 표시되지만 여전히 데이터베이스에는 테이블이 없습니다. 누구나이 문제에 대한 해결책이 있습니까? 내 문제와 관련된 거의 모든 링크를 검색했지만 아무 것도 효과가 없습니다. 35 :최대 절전 모드에서 jpa가 자동으로 테이블을 생성하지 않음

여기이 내가 콘솔

(16)에 무엇을 얻을 내 persistence.xml을

<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" 
      version="2.0"> 

     <persistence-unit name="pl4sms-persistence" > 
     <provider>org.hibernate.ejb.HibernatePersistence</provider> 


    <class>com.ecomm.pl4sms.persistence.entities.SampleBatch</class> 
    <class>com.ecomm.pl4sms.persistence.entities.SampleMessage</class> 



     <properties> 
      <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> 
     <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/samplejpa"/> 

     <property name="hibernate.connection.username" value="root"/> 
     <property name="hibernate.connection.password" value="root"/> 
     <property name="hibernate.show_sql" value="true" /> 
     <property name="hibernate.hbm2ddl.auto" value="create" /> 
      </properties> 
    </persistence-unit> 
</persistence> 

입니다 48,881 INFO [org.hibernate.annotations.common.Version (ServerService 스레드 풀 - - 23) HCANN000001 : Hibernate Commons Annotations {4.0.4.Final} 16 : 35 : 49,069 INFO [Server.h] HHH000400 : Dialect 사용하기 : org.hibernate.dialect. H2Dialect 16:35:49,084 WARN [Server.http.H2Dialect] (ServerService 쓰레드 풀 -23) HHH000431 : H2 데이터 바를 결정할 수 없습니다. (ServerService Thread Pool - 23) HHH000397 : ASTQueryTranslatorFactory 사용하기 16 : 35 : 49,537 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] hibernate.tool.hbm2ddl.SchemaExport] (ServerService 스레드 풀 - 23) HHH000227 : hbm2ddl 스키마 내보내기 실행

+0

gui tool pgAdmin for postgres – silentprogrammer

+0

예 데이터베이스를 만들기 위해 pgAdmin을 사용했습니다. – user3588548

+0

작성 쿼리가 콘솔에 표시되어 이상한 점이 있습니다. 테이블에 대해 pgAdmin'PostgreSql-> samplejpa-> Schemas-> public-> Tables'를 확인 했습니까? . 콘솔에 문제가있을 수 있습니다. – silentprogrammer

답변

0

로그에 테이블이 생성 되었음이 분명하게 표시됩니다. 예외가 있거나 이와 유사한 것이 있으면 질문에 게시해야합니다.

+0

예외는 없다 ... 그게 내가 말하고있는 것은 테이블이 생성되었지만 데이터베이스에 테이블이 없다는 것이다. – user3588548

+0

그들은 생성된다. localhost PostgreSQL 서버의 samplejpa 데이터베이스에 있습니다. org.hibernate에 추적 로그 레벨을 추가하여 데이터베이스 URL의 유효성을 검증하십시오. –

+0

예 데이터베이스를 만들었지 만 samplejpa 데이터베이스에 테이블이 없습니다. 동일한 구성이 testng과 함께 잘 작동하기 때문에 wildfly가 있습니다 – user3588548