Hi,
I have a simple OneToMany relationship.
User --> Queue --> QueueItems
A user has a colletion of Queues and each Queue has a colletion of QueueItems.
Now,
- User and Queue are joined by a Join table (User_Queue table), but
- Queue and QueueItems are joined by foreign key queueId. Also 'queueId' is
not the primary key of QueueItems.
So my object structure goes like this
------------------------------------------------------
@Entity
@Table(name = "User")
public class User implements Serializable {
.
.
.
@OneToMany(fetch=FetchType.EAGER)
@OrderBy("siteNumber,queueId ASC")
@JoinTable(
name="User_Queue ",
joinColumns=
@JoinColumn(name="USER_NAME", referencedColumnName="USER_NAME"),
inverseJoinColumns=
@JoinColumn(name="QUEUE_ID", referencedColumnName="QUEUE_ID")
)
private Collection<Queue> queues;
}
----------------------------------------------------
@Entity
@Table(name = "T_EVAL_QUEUES")
public class Queue implements Serializable {
.
.
.
@OneToMany(fetch=FetchType.EAGER)
@ElementJoinColumn(name="QUEUE_ID", referencedColumnName="QUEUE_ID")
private Collection<LirChecks> lirChecks;
}
------------------------------------------------------
@Entity
@Table(name = "Queue_Items")
public class QueueItems implements Serializable {
.
.
.
@Column (name = "QUEUE_ID")
private Integer queueId;
}
Now when I just try to fetch the queues of User then its working fine, but when
I try to fetch the queueItems then its giving me an exception. Below is the
exception trace.
<openjpa-1.2.1-SNAPSHOT-r422266:686069 nonfatal general error>
org.apache.openjpa.persistence.PersistenceException: null
I have spent whole day yesterday on this to fix it but in vain.
Please advice.
--
View this message in context:
http://n2.nabble.com/OneToMany-PersistenceException-tp2634657p2634657.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.