我有一个包装类,其中包含泛型列表
SELECT dbo.[U1$Job Task].[Job No_] AS Job,
dbo.[U1$Job Task].[Job Task No_] AS [Cost Code],
dbo.[U1$Job Task].Description,
dbo.[SFI Barcode Entry].MapID
FROM dbo.[U1$Job Task] LEFT OUTER JOIN dbo.[SFI Barcode Entry]
ON concat( concat(concat (dbo.[U1$Job Task].[Job No_], '|'), concat (dbo.[U1$Job Task].[Job Task No_], '|')), dbo.[U1$Job Task].[Job Task Type])= dbo.[SFI Barcode Entry].MapValue
LEFT OUTER JOIN dbo.U1$Job
ON dbo.[U1$Job Task].[Job No_] = dbo.U1$Job.No_
WHERE (dbo.U1$Job.Status = 2)
我这样使用它:
@Entity
public class Rubrique<T> {
...
@OneToMany(cascade = CascadeType.ALL, mappedBy = "declaration", fetch = FetchType.LAZY, orphanRemoval = true)
List<T> items = new ArrayList<T>();
...
,这里是我的班级ActivConsultant:
@Entity
public class Declar {
Rubrique<ActivConsultant> activConsultant = new Rubrique<ActivConsultant>();
public Rubrique<ActivConsultant> getActivConsultant() {
return activConsultant;
}
但是我不能用冬眠映射这些实体,我有这个错误:
@Entity
public class ActivConsultant {
@ManyToOne
private Rubrique<?> rubrique;
...
答案 0 :(得分:1)
您不能将泛型与Hibernate一起使用,Hibernate如何知道List项应映射到哪个数据库表?
错误消息也正是这样:
属性fr.hatvp.parsatorApp.model.Rubrique.items具有未绑定类型 并且没有明确的目标实体。解决此通用用法问题或设置 明确的目标属性(例如@OneToMany(target =)或使用 显式@Type