Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4
От | pharoz |
---|---|
Тема | Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4 |
Дата | |
Msg-id | 1323270625199-5055944.post@n5.nabble.com обсуждение исходный текст |
Ответ на | Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4 (Samuel Gendler <sgendler@ideasculptor.com>) |
Список | pgsql-jdbc |
Hi, Thx all for your diagnostic, I just found a solution. You have to create your own PostgreSQLDialect as public class PostgreSQLDialect extends org.hibernate.dialect.PostgreSQLDialect { public PostgreSQLDialect() { super(); // tells to hibernate to not use result returned by INSERT .... RETURNING * this.getDefaultProperties().setProperty(AvailableSettings.USE_GET_GENERATED_KEYS, "false"); } } From now you have to solution : 1) let hibernate to do a "select currval ..." query, see #getIdentitySelectString in org.hibernate.dialect.PostgreSQLDialect 2) if all of your bean have same pk name (ex: id), you can optimize insert process by adding two methods to your custom Dialect : @Override public String appendIdentitySelectToInsert(String insertString) { return insertString + " RETURNING id"; } @Override public boolean supportsInsertSelectIdentity() { return true; } PHaroZ -- View this message in context: http://postgresql.1045698.n5.nabble.com/Problems-with-Hibernate-Discriminators-and-9-0-801-jdbc4-tp4259788p5055944.html Sent from the PostgreSQL - jdbc mailing list archive at Nabble.com.
В списке pgsql-jdbc по дате отправления: