I do use the embedded class TimePeriod(validFrom, validTo) in diffrent Business entities. These entities are mapped to different tables. Loading multiple entities in one session creats only one TimePeriode objct for all off these classes if they have the same time periode. If I change the time periode of one entity using getTimePeriod().setValidFrom(...) the valid from property is changed for all Business entities. After flush() many of the validFrom colums I loaded before are changed although I wanted to change only one.
Does anyone know how I can avoid getting only one Object for all the TimePeriods ??
Code:
@Type(type = "at.itsv.lea.be.cut.TimePeriodCompositUserType")
@Columns(columns = { @Column(name = "gueltigVon", nullable=true),
@Column(name = "gueltigBis", nullable=true) })
@Embedded
private TimePeriod zeitraum;
Code:
@Embeddable
public class TimePeriod implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private java.util.Date gueltigVon = null;
private java.util.Date gueltigBis = null;