Opps my JIRA reference in comment 1 should be to https://hibernate.atlassian.net/browse/HHH-1675
in here it also talks of hibernate supporting INSERT INTO table (col1,col2) VALUES('value1','value2') RETURNING id;
Which is org.hibernate.dialect.Dialect.appendIdentitySelectToInsert(String)
If this were implemented then I think <generator class="native"/> should be IDENTITY, SEQUENCE. I think maybe JDBC3+ drivers support getGeneratedKeys(), I can test if you can assist with better and seamless identity support possibly removing the additional SELECT round-trip to for ID.
|