hibernate/hibernate-orm — comment on commit fa6a2f615961092007b74d82cc1178926b38ae3b
File:  line 0
By amorfis:

Ok, sorry for the rollback. Still a lot to learn for me in the world of Hibernate.

Yes, it's insert and read of the resulting result set, but _on_second_time. First time it inserts, reads ID from discriminator column, which is 1, and sets ID=1 on the entity. Everything is ok.

Second write. It executes insert, reads ID from discriminator column, which is still 1, and tries to set it as entity id. Here it fails, because we already have entity with ID=1.