Qin Ding wrote:
How does it work? Is it that hibernate first issue a sql to get an id from oracle sequence, populate the class id property and then issue another sql to insert all persistent the properties to the table including the id field?
Yes, that is the way it works. If you have an autogenerated id, you could probably work around it by using the "identity" generator, and create a subclass of the dialect you use. Then override getIdentitySelectString() to return the SQL query needed to retrieve the last generated id.