Bonjour,
j'essaie de lier 2 tables grace à @onetomany et @manytoone. J'ai le code suivant :
Dans le fichier Declaration.java :
Dans le fichier Qualification.java :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "declaration") private List<Qualification> qualifications;
J'obtient l'erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "DECLARATION", nullable = false) private Declaration declaration;
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor' defined in ServletContext resource [/WEB-INF/injectionSpringTransactionDB.jonas.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myEntityManagerFactory' defined in ServletContext resource [/WEB-INF/injectionSpringTransactionDB.jonas.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: ft.proto.v2.persistance.bean.declaration.Declaration.qualifications[ft.proto.v2.persistance.bean.declaration.Qualification]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myEntityManagerFactory' defined in ServletContext resource [/WEB-INF/injectionSpringTransactionDB.jonas.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: ft.proto.v2.persistance.bean.declaration.Declaration.qualifications[ft.proto.v2.persistance.bean.declaration.Qualification]
Caused by: org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: ft.proto.v2.persistance.bean.declaration.Declaration.qualifications[ft.proto.v2.persistance.bean.declaration.Qualification]
Merci d'avance pour votre aide
Partager