在Postgres中,我有以下表格:
CREATE TABLE punching_history (
id_punching serial NOT NULL,
punching_date timestamp without time zone,
-- other fields
CONSTRAINT punching_pk PRIMARY KEY (id_punching)
);
CREATE TABLE punching()
INHERITS (punching_history);
和此序列(由punching_history的串行字段自动生成):
CREATE SEQUENCE punching_history_id_punching_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
插入(持久)到打孔表中可以工作,但是有时,显然没有原因,它会因以下错误而失败:
"HTTP 500 Internal Server Error - could not extract ResultSet
org.postgresql.util.PSQLException: ERROR: relation
<schema_name>.punching_id_punching_seq does not exist Position: 16"
在Hibernate中,主键映射为:
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID_PUNCHING", unique = true, nullable = false)
private Integer idPunching;
为什么Postgres会寻找punching_id_punching_seq关系?一直是punching_history_id_punching_seq。
谢谢