无法完成架构更新Envers + Firebird

时间:2016-05-11 16:41:40

标签: java hibernate firebird

  • hibernate-core 4.3.7
  • 冬眠-JPA-2.1-API
  • hibernate-envers 4.3.11
  • Firebird 2.5.5

我尝试使用Envers但我遇到了麻烦: 无法完成架构更新:org.hibernate.MappingException:org.hibernate.dialect.FirebirdDialect不支持池化序列

""Didy," a clinical case of cognitive dysfunction syndrome", etc.  

2 个答案:

答案 0 :(得分:1)

如果您对这些行发表评论,Hibernate可以生成您的表格:

//@SequenceGenerator(name = "GEN_BOOKS", sequenceName = "GEN_BOOKS", allocationSize = 1)
//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "GEN_BOOKS")

在持久性中是必要的:

<property name="hibernate.hbm2ddl.auto" value="create"/>

启动服务器和表格。

然后现在需要手动创建Trigguer和Generator

CREATE GENERATOR GEN_BOOKS;
SET GENERATOR GEN_BOOKS TO 1;

CREATE TRIGGER TR_BOOKS_ID FOR BOOKS
ACTIVE BEFORE INSERT POSITION 0
AS
  BEGIN
    IF (NEW.ID IS NULL) THEN NEW.ID = GEN_ID(GEN_BOOKS , 1);
   END ;

COMMIT WORK;

删除持久性:

<property name="hibernate.hbm2ddl.auto" value="create"/>

删除

中的内容
//@SequenceGenerator(name = "GEN_BOOKS", sequenceName = "GEN_BOOKS", allocationSize = 1)
//@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "GEN_BOOKS")

相反,您可以手动创建表格

注释@AuditedTable ( value = "BOOKS_LOG")

CREATE TABLE BOOKS_AUD(
  ID INTEGER NOT NULL,         
  REV     INTEGER NOT NULL,    <-- IMPORTANT
  REVTYPE SMALLINT,            <-- IMPORTANT
  TITLE VARCHAR(45)

);

GENERATOR和TRIGGER

   CREATE REVINFO (     
        ID integer not null, 
        REV integer not null, 
        REVTYPE smallint, 
        TITLE varchar(45) 
    );

    ALTER TABLE REVINFO ADD
    PRIMARY KEY (ID ,REV);

GENERATOR和TRIGGER

答案 1 :(得分:0)

目前似乎Hibernate并不认为

https://hibernate.atlassian.net/browse/HHH-8979