Hello,
I'm new to Hibernate so please help me solve this problem.
I'm using one session to read an object and another to save it in DB (this is a business case I can't change, I tested to save with the first session directly and it's OK).
So I need to merge the object to the second session, but it's not working. I get 'UnresolvedEntityInsertActions'.
Here is a part of the code which seems problematic :
Code:
@Entity
@Table(name = "mr_tm_financial_data")
@SequenceGenerator(allocationSize = 1, initialValue = 1, name = "mr_tm_financial_data_id_seq", sequenceName = "mr_tm_financial_data_id_seq")
public class TimeMaterialFinancialData implements Serializable {
...
@ManyToOne
@JoinColumn(name = "contractSignatureId", referencedColumnName = "id", nullable = false)
private ContractSignature contractSignature;
...
And here is a warning I see in the log :
WARN UnresolvedEntityInsertActions - HHH000437: Attempting to save one or more entities that have a non-nullable association with an unsaved transient entity. The unsaved transient entity must be saved in an operation prior to saving these dependent entities.
Unsaved transient entity: ([com.mr.model.finance.ContractSignature#0])
Dependent entities: ([[com.mr.model.finance.TimeMaterialFinancialData#78]])
Non-nullable association(s): ([com.mr.model.finance.TimeMaterialFinancialData.contractSignature])
Could you please explain me why it's working with one session, and not with two when I do a merge operation ? Do you think a mapping change will solve the problem ?
Thanks