2016-07-11 11 views
0

최대 절전 모드 4.3.11을 사용하여 Wildfly 8.2.1을 시작하는 동안 DDL을 PostgreSQL 9.4 데이터베이스로 내보내려고합니다.hbm2ddl 스키마 내보내기가 '스키마 없음'으로 인해 실패했습니다. XYZ "찾을 수 없습니다."

DDL을 최대 절전 모드 - 받는다는 - 플러그인 (http://juplo.de/hibernate-maven-plugin/)를 사용하여 만들어지고 다음과 같습니다되었다 : 이제

<?xml version="1.0" encoding="UTF-8" ?> 
<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" xmlns="http://java.sun.com/xml/ns/persistence"> 
    <persistence-unit name="${persistence.unitName}" transaction-type="JTA"> 
     <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> 
     <class> 
    net.my-project.publisher.entity.UserEntity 
     </class> 
    <class> 
    net.my-project.publisher.entity.RoleEntity 
    </class> 
    <class> 
    net.my-project.publisher.entity.PermissionEntity 
    </class> 
    <properties> 
    <property name="hibernate.connection.driver_class" 
       value="org.postgresql.Driver"/> 
    <property name="hibernate.connection.url" 
       value="jdbc:postgresql://localhost:5432/my-project"/> 
    <property name="hibernate.connection.username" 
       value="${postgresql.login}"/> 
    <property name="hibernate.connection.password" 
       value="${postgresql.password}"/> 
    <property name="hibernate.default_schema" 
       value="${persistence.unitName}"/> 
    <property name="hibernate.dialect" 
       value="org.hibernate.dialect.PostgreSQL9Dialect"/> 
    <property name="hibernate.archive.autodetection" 
       value="class"/> 
    <property name="hibernate.hbm2ddl.auto" 
       value="create"/> 
    <property name="hibernate.max_fetch_depth" 
       value="3"/> 
    <property name="hibernate.show_sql" 
       value="true"/> 
    <property name="hibernate.format_sql" 
       value="true"/> 
    <property name="hibernate.order_updates" 
       value="true"/> 
    <property name="hibernate.generate_statistics" 
       value="true"/> 
    <property name="hibernate.use_sql_comments" 
       value="true"/> 
    <property name="hibernate.cache.use_query_cache" 
       value="true"/> 
    <property name="hibernate.cache.use_second_level_cache" 
       value="true"/> 
    <property name="hibernate.cache.provider_class" 
       value="org.hibernate.cache.EhCacheProvider"/> 
    <property name="hibernate.cache.region.factory_class" 
       value="org.hibernate.cache.EhCacheRegionFactory"/> 
    <property name="hibernate.cache.use_structured_entries" 
       value="true"/> 
    <property name="hibernate.transaction.auto_close_session" 
       value="false"/> 
    <property name="hibernate.connection.charSet" 
       value="UTF-8"/> 
    </properties> 

:

alter table users_permissions 
    drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j; 

[more alter table...] 

drop table permissions cascade; 

[more drop table...] 

create table permissions (
    user_ID int8 not null, 
    permission varchar(64) not null, 
    primary key (user_ID) 
); 

[more create table...] 

alter table users 
    add constraint UK_ey6y24h3nkw1cvrryc9khsl5p unique (user_name, email); 

[more alter table...] 

create sequence hibernate_sequence; 

이 내의 persistence.xml이다 , WildFly 서버로의 배치가 일어날 때, Hibernate는 내 persistence.xml을 분석하고 DDL을 PostgreSQL 데이터베이스로 내보내려고합니다. 그러나, 실패 :이 약

[org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-10) JBAS010417: Started Driver service with driver-name = my-project.ear_org.postgresql.Driver_9_4 
[org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment my-project.ear 
[org.jboss.as.jpa] (ServerService Thread Pool -- 50) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'my-project.ear/persistence-0.1-SNAPSHOT.jar#my-project' 
[org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 50) HCANN000001: Hibernate Commons Annotations {4.0.4.Final} 
[org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 50) HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL9Dialect 
[org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000227: Running hbm2ddl schema export 
[stdout] (ServerService Thread Pool -- 50) Hibernate: 
[stdout] (ServerService Thread Pool -- 50)  alter table my-project.users_permissions 
[stdout] (ServerService Thread Pool -- 50)   drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j 
[org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000389: Unsuccessful: alter table my-project.users_permissions drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j 
[org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) Schema "MY-SCHEMA" not found; SQL statement: 

alter table my-schema.users_permissions 
    drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j [90079-173] 

재미있는 것은 내가 성공적으로의 persistence.xml에 주어진 자격 증명을 사용하여 내 PostgreSQL 서버에 pgadmin3를 통해 로그인 할 수 있다는 것입니다. 또한 "my-schema"라는 스키마에 액세스 할 수 있습니다.

따라서 구성에 문제가있을 수 있습니다. Hibernate가 스키마를 찾을 수없는 이유는 무엇입니까?

도움이 매우 감사합니다. 월터

업데이트 : 죄송합니다. 원래 게시물에 오타가 있습니다! 그것은 "my-project.users_permissions"가 아니라 "my-schema.users_permissions"입니다.

[org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000389: Unsuccessful: alter table my-schema.users_permissions drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j 
[org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) Schema "MY-SCHEMA" not found; SQL statement: 

alter table my-schema.users_permissions 
    drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j [90079-173] 

답변

0

"my-schema"에 액세스 할 수 있지만 스택 추적은 "my-project"라는 스키마를 나타냅니다. 그 중 하나가 존재하는지 확인하겠습니다.

[stdout] (ServerService Thread Pool -- 50) Hibernate: 
[stdout] (ServerService Thread Pool -- 50)  alter table my-project.users_permissions 
[stdout] (ServerService Thread Pool -- 50)   drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j 
[org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 50) HHH000389: Unsuccessful: alter table my-project.users_permissions drop constraint if exists FK_eije6ps36awul7w1e8w9x0k0j 
+0

음, 죄송합니다. 그건 나쁘다. 그것은 오타입니다. 나는 그것을 두 번 점검했다. Hibernate는 실제로 my-schema.users_permissions를 찾고있다. – Walter