Page 1 of 1

Duplicate entry in OneToOne relationship while update

Posted: Thu May 07, 2015 5:10 am
by ankit90
Hi All,

I have @OneToOne relationship between two entity in blc admin.
For example
1. Office
2. Office billing address

Now here office billing address is optional.

In OfficeImpl
@OneToOne(mappedBy = "office",targetEntity = OfficeBillingAddressImpl.class)
@Cascade(value={org.hibernate.annotations.CascadeType.MERGE, org.hibernate.annotations.CascadeType.PERSIST, org.hibernate.annotations.CascadeType.SAVE_UPDATE})
protected OfficeBillingAddress address;

In OfficeAddressImpl

@OneToOne(targetEntity = OfficeImpl.class)
@JoinColumn(name = "OFFICE_ID", unique = true)
private Office office;

Now, From BLC Admin UI, If I create Office with office address, it is working fine.
But if i create office first and save it.. after that when i update office with office address ,
at that time there is duplicate entry is falling in office address table, one has office_id and other has null.


Thanks,
Ankit

Re: Duplicate entry in OneToOne relationship while update

Posted: Wed May 20, 2015 12:01 am
by phillipuniverse
What version of Broadleaf is this on?