ISSUE :
 
Profile photo
Submitted by Mark Mazerski
on March 17th, 2017 at 10:49:11 EST

Hibernate Duplicate property mapping _OjbectBackref error

Hi,
I am trying to reuse same table from two different object and I get this error.

org.hibernate.MappingException: Duplicate property mapping of _researchMgmtSetBackref found in gov.nih.tbi.repository.model.hibernate.ResearchManagement

Thanks,
MM


Profile photo
Replied by Yogaraj Khanal
on March 17th, 2017 at 10:51:38 EST
You have to use different name references.For eg
For Ojbect 1 use
@XmlTransient
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "oebjct1_id", nullable = false)
private Set<ObjectToShare> objectOneSet = new HashSet<ObjectToShare>();
For Ojbect2 use
@XmlTransient
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "oebjct2_id", nullable = false)
private Set<ObjectToShare> objectTwoSet = new HashSet<ObjectToShare>();