我有这个代码:
@Entity
@Table(name = "table")
@SequenceGenerator(name="table_id_seq", sequenceName="table_id_seq", allocationSize=1)
public class TableExample extends BaseEntity implements Serializable {
/**
* The auto-generated primary key.
*/
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="table_id_seq")
@Column(name = "table_id")
private long id;
}
我的数据库中有这个序列:
CREATE SEQUENCE table_id_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 2000
CACHE 1;
ALTER TABLE table_id_seq OWNER TO postgres;
当我试图持久化一个新对象时,我收到了这个错误:
org.apache.openjpa.persistence.PersistenceException:错误:当前事务被中止,命令被忽略直到事务块结束 {prepstmnt 642363 SELECT NEXTVAL('table_id_seq')} [code=0, state=25P02]
我错过了什么吗?提前致谢