Collection not yet supported
Bonjour,
Je travaille avec les annotations EJB et Hibernerate.
J'ai deux classes qui héritent de deux autres classes :
Classes meres :
Code:
1 2 3 4 5 6 7 8 9 10 11
|
@MappedSuperclass
public abstract class DonneeRef<T extends Donnee> {
// private T _actuel;
public abstract List<T> getHistorique();
public abstract List<T> getHistorique(Date de, Date a);
public abstract List<T> getHistorique(Date d);
public abstract T getActuel();
} |
Code:
1 2 3 4
|
public abstract class Donnee<T extends DonneeRef> {
public abstract T getRef();
} |
Classes "filles" :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
@Entity
public class PosteRef extends DonneeRef<Poste> {
private long _id;
private Poste _posteActuel;
/** A priori ça c'est bon ! */
@OneToMany(targetEntity=Poste.class, mappedBy="Id", fetch=FetchType.LAZY)
@Override
public List<Poste> getHistorique() {
return null;
}
@Override
public List<Poste> getHistorique(Date de, Date a) {
// Select p from Poste p where p.ref = ? and ? >= dde and dfe <=?
return null;
}
@Override
public List<Poste> getHistorique(Date d) {
return null;
}
@Id
public long getId() {
return _id;
}
public void setId(long id) {
_id = id;
}
@OneToOne(targetEntity=Poste.class, mappedBy="_ref", fetch=FetchType.LAZY)
@PrimaryKeyJoinColumn
public Poste getPosteActuel() {
return _posteActuel;
}
public void setPosteActuel(Poste posteActuel) {
_posteActuel = posteActuel;
}
@Override
public Poste getActuel() {
return getPosteActuel();
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
@Entity
@Embeddable
public class Poste extends Donnee {
private PosteId _posteId;
private Periode _effet;
private Periode _validation;
private String _libelle;
private DonneeRef _ref;
public Periode getValidation() {
return _validation;
}
public void setValidation(Periode validation) {
_validation = validation;
}
public Periode getEffet() {
return _effet;
}
public void setEffet(Periode effet) {
_effet = effet;
}
public String getLibelle() {
return _libelle;
}
public void setLibelle(String libelle) {
_libelle = libelle;
}
@OneToMany(targetEntity=PosteRef.class, mappedBy="Id", fetch=FetchType.LAZY)
@Override
public DonneeRef getRef() {
return _ref;
}
public void setRef(DonneeRef ref) {
_ref = ref;
}
@EmbeddedId
public PosteId getPosteId() {
return _posteId;
}
public void setPosteId(PosteId posteId) {
_posteId = posteId;
}
} |
Lorsque j'initialise la session hiberntate, mon application est censé créer les tables correspondante aux classes "filles" dans ma base de données.
Code de test :
Code:
1 2
|
Session sess = HIUtil.getSession(); |
Cependant j'obtiens l'erreur suivante :
Citation:
org.hibernate.AnnotationException: com.graa.fwk.donnee.DonneeRef collection not yet supported: com.graa.fwk.donnee.Posteref
at org.hibernate.cfg.annotations.CollectionBinder.getCollectionBinder(CollectionBinder.java:197)
at org.hibernate.cfg.AnnotationBinder.processElementAnnotations(AnnotationBinder.java:1175)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:629)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:276)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:210)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1168)
at com.graa.fwk.hibernate.HIUtil.getSessionFactory(HIUtil.java:28)
at com.graa.fwk.hibernate.HIUtil.doGetSession(HIUtil.java:101)
at com.graa.fwk.hibernate.HIUtil.getSession(HIUtil.java:96)
at com.graa.fwk.donnee.PosteTest.test1(PosteTest.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Je ne comprends pas très bien, si quelqu'un peut m'eclaircir ce serait simpa.
Merci.