I have a table (that can't be changed)
that is a one to one mapping from multiple entites to a single table
the table has 2 fields
int key1
String info
i have a mapping in table one
@OneToMany(fetch=javax.persistence.FetchType.LAZY, mappedBy="associationsCalendar")
private List associationRelators;
and in table 2
@OneToMany(fetch=javax.persistence.FetchType.LAZY, mappedBy="associationsAdvisory")
private List associationRelators; //Associations
in the end table i have the following relationships.
@ManyToOne(fetch=javax.persistence.FetchType.LAZY, optional=true)
@JoinColumn(name="PRNT_CNTNT_ID", insertable=false, updatable=false, nullable=true)
private Calendar associationsCalendar; //Associations
@ManyToOne(fetch=javax.persistence.FetchType.LAZY, optional=true)
@JoinColumn(name="PRNT_CNTNT_ID", insertable=false, updatable=false, nullable=true)
private Advisory associationsAdvisory; //Associations
I have a web service that is serialising the records, and i only want to serialise the join on the record that actually exists.
i.e. calendar and advisory take their primary keys from the same sequence.
if the reference is for a advisory and i call getAssociationsCalendar() i get
org.hibernate.PropertyAccessException: could not set a field value by reflection setter of .....
I need a way of having the exception not thrown, or a way to get around this issue. I have multiple tables that have the same issue, and am using a library to serialise the objects.
any help will be much appreciated.