Salu tout le monde,

J'ai besoin d'aide. Je travaille sur un projet j2ee6 avec jpa (eclipseLink) cependant j ai quelques erreurs.

Quand je crée des entities sans liaison entre elles, tout marche. Mais quand j essaye de mettre en place @oneTomany @ManyToOne, j'obtiens une erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
Exception Description: [class com.Domain.User] uses
[ERROR] a non-entity [class com.Domain.Groups] as target entity in the
[ERROR] relationship attribute [field groupe].
Voici mon entity user :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
@Entity
@NamedQueries({ 
@NamedQuery(name = "findAllUsers", query="select u from User u"), 
@NamedQuery(name = "findWithLogParam", query="select u from User u where u.Email = :fmail and u.Password = FUNC('sha1', :fpass)")
})
public class User implements Serializable{
/**
* 
*/
private static final long serialVersionUID = 3175161374832714727L;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private Long UserId;
@Column(nullable = false)
private String Title = "Mr"; 
@Column(nullable = false)
private String Login;
@Column(nullable = false)
private String Password;
@Column(nullable = false)
private String Firstname; 
@Column(nullable = false)
private String Lastname;
@Column(nullable = false)
private String Email; 
private String Telephone;
private String Mobile;
@Temporal(TemporalType.DATE)
private Date Date_of_birth;
private String Postcode;
private String Address;
private String City;
private String County;
private String Region;
private String Country;
private String AccountEnabled="On";
@ManyToOne(optional=false)
@JoinColumn(name="GROUPID", referencedColumnName="GROUPID")
private Groups groupe;
private String Token;
Voici l'entity groups :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
@Entity
public class Groups implements Serializable{
 
private static final long serialVersionUID = 7092895671981671161L;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
private Long GroupId;
@Column(nullable = false)
private String GroupName; 
@OneToMany(mappedBy="groupe", targetEntity=User.class, fetch=FetchType.EAGER)
private List<User> UserList = new ArrayList<User>();
Voici mon persistence.xml :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="windows-1252" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="testPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>	
<jta-data-source>jdbc/UnmodDB</jta-data-source>	
<class>com.Domain.User</class>
<class>com.Domain.Groups</class>
........ other classes ......
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-database" value="MySQL"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
<property name="eclipselink.ddl-generation.output-mode" value="database" />
<property name="eclipselink.create-ddl-jdbc-file-name" value="create.sql"/>
</properties>
</persistence-unit>
</persistence>
Ca marche quand j'ajoute @Basic cependant seulement la table user est créée. Le fait d'utilisé @jointable / @jointColumn provoque la même chose.

Merci pour votre aide.