Hi @ all,
Hibernate-core: v.3.3.2
Hibernate-Annotations: v.3.4.0
Hibernate-Common-Annotations: v.3.1.0
i got an exception while implementing an abstract generic class:
Code:
Caused by: org.hibernate.AnnotationException: Property org.portfolio.data.ReportElement.content has an unbound type and no explicit target entity. Resolve this Generic usage issue or set an explicit target attribute (eg @OneToMany(target=) or use an explicit @Type
at org.hibernate.cfg.AnnotationBinder.addElementsOfAClass(AnnotationBinder.java:1032)
at org.hibernate.cfg.AnnotationBinder.getElementsToProcess(AnnotationBinder.java:882)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:667)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1333)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.portfolio.data.hibernate.HibernateUtil.<clinit>(HibernateUtil.java:36)
My abstract class is:
Code:
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "ReportElement")
public abstract class ReportElement<T, E> implements Serializable,
Comparable<ReportElement<T, E>> {
private static final long serialVersionUID = 1L;
protected T content;
@Id
@GeneratedValue
@ManyToOne
@JoinColumn(name = "element_fk", insertable = false, updatable = false)
private long Id;
protected E status;
public abstract void addContent(T Content);
public abstract int compareTo(final ReportElement<T, E> o);
public abstract T getContent();
public long getId() {
return this.Id;
}
public abstract E getStatus();
public abstract void setContent(final T content);
public void setId(final long id) {
this.Id = id;
}
public abstract void setStatus(final E status);
}
And the client:
Code:
@Entity
@Table(name = "ReportElementSingleContent")
public class ReportElementSingleContent extends ReportElement<String, Boolean> {
private static final long serialVersionUID = 1L;
@Override
@Column(nullable = false)
public void addContent(final String Content) {
super.content = this.content;
}
public void addInformations(final String content, final Boolean status) {
this.setContent(content);
this.setStatus(status);
}
@Override
public int compareTo(final ReportElement<String, Boolean> o) {
return 0;
}
@Override
public String getContent() {
return super.content;
}
@Override
@Column(nullable = false)
public Boolean getStatus() {
return super.status;
}
@Override
public void setContent(final String content) {
super.content = content;
}
@Override
public void setStatus(final Boolean status) {
super.status = status;
}
}
Can someone please help me?
Regards