[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Hibernate One To Many, multiple relationships off a single f
taggat
do-not-reply at jboss.com
Fri May 1 10:21:34 EDT 2009
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.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4228018#4228018
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4228018
More information about the jboss-user
mailing list