Is it really a trigger you've created for the table or a built-in identity column? If a trigger, I'm not sure of the solution. There's an "assigned" ID generator, but the docs say
lets the application to assign an identifier to the object before save() is called.
[my emphasis]
You could, of course, check the Hibernate forums to see if someone has added an "assigned-by-trigger" option.
If it's an identity column, you need to switch the ID generator from "sequence" to "identity":
supports identity columns in DB2, MySQL, MS SQL Server, Sybase and HypersonicSQL.
This tells Hibernate to let the DB assign the ID for new objects.
It's also possible that "identity" works with a trigger, but I believe that databases that support an identity-type column provide a method to make the last generated ID available that Hibernate uses to store the ID into the object in the Session (and second-level cache, if you're using one). You'd probably have to code up something specific to make the trigger's assigned ID simmilarly available.
[ January 14, 2005: Message edited by: David Harkness ]