2011-11-01 2 views
0

최대 절전 모드 (3.2.5)를 PostgreSQL 8.2와 연결하려고합니다. hbm.xml 파일의 인증서와 관계 인증서를 매핑하려고 할 때 다음 예외가 발생합니다.최대 절전 모드로 Postgres를 연결할 수 없습니다

**

PSQLException: ERROR: relation "certificate" does not exist

**

만들기위한 SQL 인증 :

CREATE TABLE "Certificate" ( id bigint NOT NULL,
name text,
CONSTRAINT certificate_pk1 PRIMARY KEY (id)
) WITHOUT OIDS;

POJO와 제공자 라이선스 계약 '인증서'입니다 :

public class Certificate implements Serializable { 
private static final long serialVersionUID = 1L; 
private Long id; 

private String name; 

public String getName() { 
    return name; 
} 

public void setName(String name) { 
    this.name = name; 
} 

public Long getId() { 
    return id; 
} 

public void setId(Long id) { 
    this.id = id; 
} 


public String toString() { 
    return "model.Certificate[id=" + id + "]"; 
} 

}

있는 hibernate.cfg.xml 파일 :

"<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost /Company</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">abc123</property>
<mapping resource="hibernate.hbm.xml"/>
</session-factory>
</hibernate-configuration>

"

답변

3

이 오류는 다음과 같습니다

PSQLException: ERROR: relation "certificate" does not exist

데이터베이스, 당신은 대문자 "인증서"를 만들어 소문자 "인증서"를 검색

"Certificate"

: 16,

는 그리고 이것은 당신의 테이블입니다.

모든 식별자 주위에 동일한 케이스 큰 따옴표를 사용하거나 소문자로만 사용하면 간단 해집니다.

+0

감사합니다. 마침내 효과가있었습니다. 내가 한 것은 인증서 클래스를 매핑하는 동안 hbm.xml 파일에서 table = ""Certificate "대신에 table = '"Certificate "'를 사용했습니다. – Supereme

+0

@ 프랭크 같은 문제가 있습니다. 이상하게도 맥북은 내 아이맥에서 작동하지만 맥북은 나에게이 오류를 던지고있다. 어떻게 가능할까요? – Varundroid

관련 문제