Hi,
I have the following class structure...
Parent.java
=====================
Code:
@Entity
@Table(name="TABLE1")
@Inheritance(strategy = InheritanceType.JOINED)
abstract class Parent{
@Column(name="ID")
@Id
private Integer Id;
...
...
@Column(name="D_SOURCE_ID")
private Integer dSourceId;
}
SubClass.java
======================
Code:
@Entity
@Table(name="TABLE2")
@PrimaryKeyJoinColumn(name = "ID")
class SubClass extends Parent{
...
...
/**
*A List of CompositeElement objects.
*
*/
@OneToMany(fetch = FetchType.EAGER)
@JoinColumn( ??? )
private List<CompositeElement> element;
}
CompositeElement.java
=====================
Code:
@Entity
@Table(name="SIGN")
class CompositeElement {
...
...
@Column(name="C_D_SOURCE_ID");
private Integer compDSourceId;
}
As you can see,
Subclass entity is child of
Parent class entity.
Inside
SubClass; there is a List of 'CompositeElement' objects;
the condition is that 'CompositeElement' objects must be fetched from 'SIGN' table when (Parent.dSourceId == CompositeElement.compDSourceId).
What should i do in JoinColumn so that this can be done??!!!
Appreciate help
Regards,
Pravin