I have 3 entities:
A UserEntity (Long Id)
A ConfEntity with an IdClass (ConfId)
A UserConfEntity with also an IdClass (UserConfId)
ConfId is composed of 2 String and UserConId is composed of a Long and ConfId.
In my unit test I create all entities and I do a find on the UserEntity.
Immediately after the find, I do a flush and an exception is throwned.
looking at the code I can see that the method org.hibernate.internal.util.StringHelper.lastIndexOfLetter does not consider the character '_' called by the method org.hibernate.mapping.Column.getAlias(Dialect) and my table USER_CONF has a column with '_' in its name.
You can execute the unit test net.foo.bar.entities.test.FlushTest to reproduce the bug and see the exception.