Hibernate 休眠辅助数据库对象-未创建触发器
我试图在Hibernate映射文件中设置Postgres触发器,但它似乎没有在数据库中创建触发器。我可以在Postgres中手动创建触发器,但更愿意让Hibernate完成所有架构/DDL创建我在Hibernate.cfg.xml中有hbm2dll.auto=update,我的映射是: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-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”。似乎“更新”导致它忽略所有标记