Here is what I did to solve just by 2 ways:
make ID column as int
type
if you are using autogenerate in ID dont assing value in the setter of ID. If your mapping the some then sometimes autogenetated ID is not concedered. (I dont know why)
try using @GeneratedValue(strategy=GenerationType.SEQUENCE)
if possible