I had this problem, too. I solved it by mapping my id column as a sequence
instead of as 'identity'
<id name="id" type="int" column="application_id">
You could probably get away with creating the table with a serial column and
just passing in the sequence that postgres implicitly uses, but I thought it
safer to just explicitly declare the sequences that are used for ids. This
does mean that inserts require two queries, since there is no way to get the
generated id in the same statement that does the insert, but I don't do bulk
inserts via hibernate, so it doesn't much matter in my case.
I'd definitely prefer to have cleaner mappings and not have to manually
create/maintain the sequences, but this isn't the end of the world. This is
a pretty huge bug to have existed in the codebase for so long, though.
Personally, I never even reported it, as I thought it must be some kind of
configuration error on my part since I didn't find any reference to the
problem via google back when I looked (it was a while back - I was using pg
8.3.x at the time).
In response to
pgsql-jdbc by date
|Next:||From: Emanuel Freitas||Date: 2010-10-29 14:21:39|
|Subject: Exception in DriverManager.getConnection creates multiple connections
in SYN_SEND state|
|Previous:||From: Adam Todorski||Date: 2010-10-26 14:41:36|
|Subject: Re: getGeneratedKeys() problem|