From [url=]section 18.104.22.168[/url] of the Hibernate documentation, use the sequence generator type and provide a sequence name parameter.[ Beat me to it. ] [ March 30, 2005: Message edited by: David Harkness ]
When I try to perform the session.save(obj) operation, the Hibernate log only shows: 'Hibernate: select SEQ_SJUSTIF_FORMULIER_ID.nextval from dual' but no insert statement. (and of cources, no insert is executed...). Any idea why this occurs?
First, it's better to start a new topic for a new question. While this is related in that you use an ID generator when creating new objects, this problem would occur regardless of the generator type.
Saving and updating objects only registers them with the Session's unit of work. You must flush() the Session to make it execute the SQL statements to persist the changes in the database. Then you must commit() the Transaction you began at the start.
If you didn't explicitely begin() a transaction, Hibernate should have begun one for you. I use a framework called Spring that does all the transaction work in my application based on method tags, so I don't know if Hibernate will do this automatically, but I do know that you must tell Hibernate to either commit() or rollback() a Transaction to make your flush()ed changes permanent or undo them.
Once you've done all that, you can close() the Session or continue using a single one (preferably the former).