0
我目前正在使用JPA(EclipseLink),但由于OneToMany关系的targetEntity参数而卡住了。targetEntity在OneToMany JPA关系和抽象类
@Entity
@Table(name = "INVENTORY")
public class InventoryJPA implements IInventory {
/**
* Unique identifier of the inventory
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private int id;
/**
* The list of resources avalible in the inventory.
*/
private transient Map<Resource, Integer> resources = null;
/**
* The list of items in the inventory.
*/
@OneToMany(targetEntity = AbstractItemJPA.class,
cascade = CascadeType.ALL)
private List<IItem> items = null;
我有一个AbstractItemJPA类impl。一个IItem界面。 和其他扩展AbstractItemJPA的抽象类。
这是一个例子:
@MappedSuperclass
public abstract class AbstractControlItemJPA extends AbstractItemJPA implements IControlItem
看来的EclipseLink不想要一个抽象类的targetEntity参数。
@OneToMany(targetEntity = AbstractItemJPA.class,
cascade = CascadeType.ALL)
private List<IItem> items = null;
有没有解决方案呢?
谢谢大家!