I’m trying to setup a Postgres trigger in my Hibernate mapping file, but it doesn’t seem to create the trigger in the database. I can create the trigger manually in Postgres, but prefer to let Hibernate do all schema/DDL creation I have hbm2dll.auto=update in my hibernate.cfg.xml and my mapping is:
<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>
But no trigger is created for table “metar”. What am I missing?
I resolved this my setting the hbm2ddl.auto to “create” in my hibernate.cfg.xml. It seems that “update” causes it to ignore the tags all together.