我正在尝试连接Hibernate(3.2.5)和PostgreSQL 8.2.,但是当我尝试将类证书映射到hbm.xml文件中的关系证书时,我得到了以下异常:
证书:错误:关系“PSQLException”不存在
创建证书的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>
发布于 2011-11-02 03:46:30
这是错误:
证书:错误:关系“PSQLException”不存在
这是你的桌子:
“证书”
数据库正在搜索小写的“证书”,您创建了大写的“证书”。
使用相同的大小写和双引号将所有标识符括起来,或者只使用小写来简化。
https://stackoverflow.com/questions/7970961
复制相似问题