This means you are using a hibernate mappings like @OneToOne
or @OneToMany
.
Now for xml configuration you should include cascade="all"
or for class based annotations cascade=CascadeType.ALL
on your collection mapping.
This happens because you have a collection in your entity which has some elements which are not persisted in the database yet and hence it gives the error.
By mentioning the cascading types in your entity you tell hibernate to save all the child entities on saving the parent entity.