Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate 休眠辅助数据库对象-未创建触发器_Hibernate_Postgresql_Triggers - Fatal编程技术网

Hibernate 休眠辅助数据库对象-未创建触发器

Hibernate 休眠辅助数据库对象-未创建触发器,hibernate,postgresql,triggers,Hibernate,Postgresql,Triggers,我试图在Hibernate映射文件中设置Postgres触发器,但它似乎没有在数据库中创建触发器。我可以在Postgres中手动创建触发器,但更愿意让Hibernate完成所有架构/DDL创建我在Hibernate.cfg.xml中有hbm2dll.auto=update,我的映射是: <hibernate-mapping> <class> (class def here) </class> <database-

我试图在Hibernate映射文件中设置Postgres触发器,但它似乎没有在数据库中创建触发器。我可以在Postgres中手动创建触发器,但更愿意让Hibernate完成所有架构/DDL创建我在Hibernate.cfg.xml中有hbm2dll.auto=update,我的映射是:

     <hibernate-mapping>
    <class>
(class def here)
    </class>    
    <database-object>
        <create>CREATE TRIGGER genUuid BEFORE INSERT ON metar FOR EACH ROW EXECUTE PROCEDURE uuid_gen();</create>
            <drop></drop>
                <dialect-scope name="org.hibernate.dialect.PostgreSQLDialect" />
    </database-object>
</hibernate-mapping>

(此处为def类)
在为每行执行过程uuid_gen()插入metar之前创建触发器Genuid;

但没有为表“metar”创建触发器。我遗漏了什么?

我解决了这个问题,在hibernate.cfg.xml中将hbm2ddl.auto设置为“create”。似乎“更新”导致它忽略所有标记