IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JPA Java Discussion :

JPA, MySQL et Tomcat


Sujet :

JPA Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Mai 2009
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Mai 2009
    Messages : 19
    Par défaut JPA, MySQL et Tomcat
    Bonjour,
    J'ai implémenté un exemple de projet web dynamic pour tester JPA et Mysql mais rien ne marche à chaque exécution ce message d'erreur :

    Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named modeliser
    at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
    at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
    at com.team.formation.modele.test.JpersistenceTest.initEntityManager(JpersistenceTest.java:37)
    at com.team.formation.modele.test.JpersistenceTest.main(JpersistenceTest.java:28)
    *** Voici mon fichier persistence.xml :

    Code xml : 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
    <persistence-unit name="modeliser" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.team.formation.model.ClientTest</class>
    <class>com.team.formation.model.ArticlesTest</class>
    <class>com.team.formation.model.CommandeTest</class>
    <class>com.team.formation.model.LigneCommandeTest</class>
     
    <properties>
    <property name="eclipselink.jdbc.driver" value="com.mysql.jdbc.Driver" />
    <property name="eclipselink.jdbc.url" value="jdbc:mysql://localhost/formation" />
    <property name="eclipselink.jdbc.user" value="formation" />
    <property name="eclipselink.jdbc.password" value="" />
     
    <!-- EclipseLink should create the database schema automatically -->
    <property name="eclipselink.ddl-generation" value="drop-and-create-tables" />
    <property name="eclipselink.ddl-generation.output-mode" value="database" />
    </properties>
    </persistence-unit>
    </persistence>

    *** Ma classe principale:

    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
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    import javax.persistence.EntityManager;
    import javax.persistence.EntityManagerFactory;
    import javax.persistence.Persistence;
    import javax.persistence.PersistenceException;
     
    import com.team.formation.model.ClientTest;
     
    /**
    * @author MFOUKA MOKONO
    *
    */
    public class JpersistenceTest {
     
    private EntityManagerFactory emf;
    private EntityManager em;
    private String PERSISTENCE_UNIT_NAME = "modeliser";
    /**
    * @param args
    */
    public static void main(String[] args) {
     
    JpersistenceTest persistenceTest = new JpersistenceTest();
    persistenceTest.initEntityManager();
    persistenceTest.create();
    persistenceTest.closeEntityManager();
     
    }
     
    private void initEntityManager() {
     
    //	 try{
    emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
    em = emf.createEntityManager();
    //	 }catch(PersistenceException pEX){
    //	 pEX.getStackTrace();
    //	 System.out.print("Erreur : " + pEX.getMessage());
    //	 }
     
    }
     
    private void closeEntityManager() {
    emf.close();
    em.close();
    }
     
    private void create() {
    em.getTransaction().begin();
    ClientTest clientTest = new ClientTest();
    clientTest.setIdClient(1);
    clientTest.setNom("MOKONO");
    clientTest.setPrenom("Brice");
    clientTest.setLogin("test");
    clientTest.setPassword("essai");
    clientTest.setAdresse("12 Avenue Matsoua Bacongo");
    clientTest.setEmail("bpmfouka@yahoo.fr");
    clientTest.setTelephone(0610320236);
     
    em.getTransaction().commit();
    }
     
    }
    **** Mes entités :

    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
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    @Entity
    @Table(name="ArticlesTest")
    public class ArticlesTest implements Serializable {
     
    /**
    * 
    */
    private static final long serialVersionUID = 3514550600993369401L;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int numeroArticle;
    private String designation;
    private float prixUnitaire;
     
    public ArticlesTest() {
    super();
    }
     
    /**
    * @return the numeroArticle
    */
    public int getNumeroArticle() {
    return numeroArticle;
    }
     
    /**
    * @param numeroArticle the numeroArticle to set
    */
    public void setNumeroArticle(int numeroArticle) {
    this.numeroArticle = numeroArticle;
    }
     
    /**
    * @return the designation
    */
    public String getDesignation() {
    return designation;
    }
     
    /**
    * @param designation the designation to set
    */
    public void setDesignation(String designation) {
    this.designation = designation;
    }
     
    /**
    * @return the prixUnitaire
    */
    public float getPrixUnitaire() {
    return prixUnitaire;
    }
     
    /**
    * @param prixUnitaire the prixUnitaire to set
    */
    public void setPrixUnitaire(float prixUnitaire) {
    this.prixUnitaire = prixUnitaire;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#hashCode()
    */
    @Override
    public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result
    + ((designation == null) ? 0 : designation.hashCode());
    result = prime * result + numeroArticle;
    result = prime * result + Float.floatToIntBits(prixUnitaire);
    return result;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#equals(java.lang.Object)
    */
    @Override
    public boolean equals(Object obj) {
    if (this == obj)
    return true;
    if (obj == null)
    return false;
    if (getClass() != obj.getClass())
    return false;
    ArticlesTest other = (ArticlesTest) obj;
    if (designation == null) {
    if (other.designation != null)
    return false;
    } else if (!designation.equals(other.designation))
    return false;
    if (numeroArticle != other.numeroArticle)
    return false;
    if (Float.floatToIntBits(prixUnitaire) != Float
    .floatToIntBits(other.prixUnitaire))
    return false;
    return true;
    }
     
    }
    ////////////:::::
    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
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    @Entity
    @Table(name="ClientTest")
    public class ClientTest implements Serializable {
     
    /**
    * 
    */
    private static final long serialVersionUID = -614513751770847367L;
     
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int idClient;
    private String nom;
    private String prenom;
    private String login;
    private String password;
    private String adresse;
    private String email;
    private double telephone;
     
    public ClientTest() {
    super();
    }
     
    /**
    * @return the idClient
    */
    public int getIdClient() {
    return idClient;
    }
    /**
    * @param idClient the idClient to set
    */
    public void setIdClient(int idClient) {
    this.idClient = idClient;
    }
    /**
    * @return the nom
    */
    public String getNom() {
    return nom;
    }
    /**
    * @param nom the nom to set
    */
    public void setNom(String nom) {
    this.nom = nom;
    }
    /**
    * @return the prenom
    */
    public String getPrenom() {
    return prenom;
    }
    /**
    * @param prenom the prenom to set
    */
    public void setPrenom(String prenom) {
    this.prenom = prenom;
    }
    /**
    * @return the login
    */
    public String getLogin() {
    return login;
    }
    /**
    * @param login the login to set
    */
    public void setLogin(String login) {
    this.login = login;
    }
    /**
    * @return the password
    */
    public String getPassword() {
    return password;
    }
    /**
    * @param password the password to set
    */
    public void setPassword(String password) {
    this.password = password;
    }
    /**
    * @return the adresse
    */
    public String getAdresse() {
    return adresse;
    }
    /**
    * @param adresse the adresse to set
    */
    public void setAdresse(String adresse) {
    this.adresse = adresse;
    }
    /**
    * @return the email
    */
    public String getEmail() {
    return email;
    }
    /**
    * @param email the email to set
    */
    public void setEmail(String email) {
    this.email = email;
    }
    /**
    * @return the telephone
    */
    public double getTelephone() {
    return telephone;
    }
    /**
    * @param telephone the telephone to set
    */
    public void setTelephone(double telephone) {
    this.telephone = telephone;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#hashCode()
    */
    @Override
    public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((adresse == null) ? 0 : adresse.hashCode());
    result = prime * result + ((email == null) ? 0 : email.hashCode());
    result = prime * result + idClient;
    result = prime * result + ((login == null) ? 0 : login.hashCode());
    result = prime * result + ((nom == null) ? 0 : nom.hashCode());
    result = prime * result
    + ((password == null) ? 0 : password.hashCode());
    result = prime * result + ((prenom == null) ? 0 : prenom.hashCode());
    long temp;
    temp = Double.doubleToLongBits(telephone);
    result = prime * result + (int) (temp ^ (temp >>> 32));
    return result;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#equals(java.lang.Object)
    */
    @Override
    public boolean equals(Object obj) {
    if (this == obj)
    return true;
    if (obj == null)
    return false;
    if (getClass() != obj.getClass())
    return false;
    ClientTest other = (ClientTest) obj;
    if (adresse == null) {
    if (other.adresse != null)
    return false;
    } else if (!adresse.equals(other.adresse))
    return false;
    if (email == null) {
    if (other.email != null)
    return false;
    } else if (!email.equals(other.email))
    return false;
    if (idClient != other.idClient)
    return false;
    if (login == null) {
    if (other.login != null)
    return false;
    } else if (!login.equals(other.login))
    return false;
    if (nom == null) {
    if (other.nom != null)
    return false;
    } else if (!nom.equals(other.nom))
    return false;
    if (password == null) {
    if (other.password != null)
    return false;
    } else if (!password.equals(other.password))
    return false;
    if (prenom == null) {
    if (other.prenom != null)
    return false;
    } else if (!prenom.equals(other.prenom))
    return false;
    if (Double.doubleToLongBits(telephone) != Double
    .doubleToLongBits(other.telephone))
    return false;
    return true;
    }
     
    }
    //////////////::
    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
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    @Entity
    @Table(name="CommandeTest")
    public class CommandeTest implements Serializable {
     
    /**
    * 
    */
    private static final long serialVersionUID = 4391597190955973559L;
    @Id
    @GeneratedValue(strategy=GenerationType.AUTO)
    private int numeroCommande;
    @OneToMany
    //	@JoinTable(name="ClientTest", @JoinColumn=@JoinColumn(name="idClient", referencedColumnName="idClient"))
    @JoinColumn(name="idClient")
    private int idClient;
    private Date dateCommande;
     
    public CommandeTest() {
    super();
    }
     
    /**
    * @return the numeroCommande
    */
    public int getNumeroCommande() {
    return numeroCommande;
    }
     
    /**
    * @param numeroCommande the numeroCommande to set
    */
    public void setNumeroCommande(int numeroCommande) {
    this.numeroCommande = numeroCommande;
    }
     
    /**
    * @return the idClient
    */
    public int getIdClient() {
    return idClient;
    }
     
    /**
    * @param idClient the idClient to set
    */
    public void setIdClient(int idClient) {
    this.idClient = idClient;
    }
     
    /**
    * @return the dateCommande
    */
    public Date getDateCommande() {
    return dateCommande;
    }
     
    /**
    * @param dateCommande the dateCommande to set
    */
    public void setDateCommande(Date dateCommande) {
    this.dateCommande = dateCommande;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#hashCode()
    */
    @Override
    public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result
    + ((dateCommande == null) ? 0 : dateCommande.hashCode());
    result = prime * result + idClient;
    result = prime * result + numeroCommande;
    return result;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#equals(java.lang.Object)
    */
    @Override
    public boolean equals(Object obj) {
    if (this == obj)
    return true;
    if (obj == null)
    return false;
    if (getClass() != obj.getClass())
    return false;
    CommandeTest other = (CommandeTest) obj;
    if (dateCommande == null) {
    if (other.dateCommande != null)
    return false;
    } else if (!dateCommande.equals(other.dateCommande))
    return false;
    if (idClient != other.idClient)
    return false;
    if (numeroCommande != other.numeroCommande)
    return false;
    return true;
    }
     
    }
    ////////:::::
    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
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    @Entity
    @Table(name="LigneCommandeTest")
    public class LigneCommandeTest implements Serializable {
     
    /**
    * 
    */
    private static final long serialVersionUID = 7725471434507308774L;
     
    @ManyToOne
    @JoinColumn(name="numeroCommande")
    private List<CommandeTest> numeroCommande = new ArrayList<CommandeTest>();
    @ManyToOne
    @JoinColumn(name="numeroArticle")
    private List<ArticlesTest> numeroArticle = new ArrayList<ArticlesTest>();
    @Id
    private int id;
    private int Quantite;
     
    /**
    * 
    */
    public LigneCommandeTest() {
    super();
    }
     
    /**
    * @return the numeroCommande
    */
    public List<CommandeTest> getNumeroCommande() {
    return numeroCommande;
    }
     
    /**
    * @param numeroCommande the numeroCommande to set
    */
    public void setNumeroCommande(List<CommandeTest> numeroCommande) {
    this.numeroCommande = numeroCommande;
    }
     
    /**
    * @return the numeroArticle
    */
    public List<ArticlesTest> getNumeroArticle() {
    return numeroArticle;
    }
     
    /**
    * @param numeroArticle the numeroArticle to set
    */
    public void setNumeroArticle(List<ArticlesTest> numeroArticle) {
    this.numeroArticle = numeroArticle;
    }
     
    /**
    * @return the id
    */
    public int getId() {
    return id;
    }
     
    /**
    * @param id the id to set
    */
    public void setId(int id) {
    this.id = id;
    }
     
    /**
    * @return the quantite
    */
    public int getQuantite() {
    return Quantite;
    }
     
    /**
    * @param quantite the quantite to set
    */
    public void setQuantite(int quantite) {
    Quantite = quantite;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#hashCode()
    */
    @Override
    public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + Quantite;
    result = prime * result + id;
    result = prime * result
    + ((numeroArticle == null) ? 0 : numeroArticle.hashCode());
    result = prime * result
    + ((numeroCommande == null) ? 0 : numeroCommande.hashCode());
    return result;
    }
     
    /* (non-Javadoc)
    * @see java.lang.Object#equals(java.lang.Object)
    */
    @Override
    public boolean equals(Object obj) {
    if (this == obj)
    return true;
    if (obj == null)
    return false;
    if (getClass() != obj.getClass())
    return false;
    LigneCommandeTest other = (LigneCommandeTest) obj;
    if (Quantite != other.Quantite)
    return false;
    if (id != other.id)
    return false;
    if (numeroArticle == null) {
    if (other.numeroArticle != null)
    return false;
    } else if (!numeroArticle.equals(other.numeroArticle))
    return false;
    if (numeroCommande == null) {
    if (other.numeroCommande != null)
    return false;
    } else if (!numeroCommande.equals(other.numeroCommande))
    return false;
    return true;
    }
     
    }
    -> Si bien que j'ai installé les jars suivants sous eclipse :
    eclipselink-jpa-modelgen.jar, mysql-connector-java-5.bin.jar et javax.persistence.jar.

    *****Est-il important d'ajouter le fichier orm.xml quand on utilise déjà les annotations dans les classes entités???

  2. #2
    Membre Expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    *****Est-il important d'ajouter le fichier orm.xml quand on utilise déjà les annotations dans les classes entités???
    Non. Les classes déclarées dans ton persistence ne sont pas non plus nécessaires, jen mets jamais.
    Pour ton erreur, où as tu placé le persistence.xml?

  3. #3
    Membre averti
    Inscrit en
    Mai 2009
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Mai 2009
    Messages : 19
    Par défaut Suite
    Bonjopur,
    J'ai placé mon fichier persistence.xml sous le répertoire WebContent/META-INF/persistence.xml !!!

  4. #4
    Membre Expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    2 938
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 2 938
    Par défaut
    Non tu dois déplacer le répertoire META-INF dans ton src java.

  5. #5
    Membre averti
    Inscrit en
    Mai 2009
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Mai 2009
    Messages : 19
    Par défaut
    Pourquoi? Alors, je modifie l'ordre structurel des répertoires?

  6. #6
    Membre averti
    Inscrit en
    Mai 2009
    Messages
    19
    Détails du profil
    Informations forums :
    Inscription : Mai 2009
    Messages : 19
    Par défaut
    Ce qui est fait mais j'ai ce message d'erreur sur la console:



    [EL Info]: 2010-09-30 14:07:38.614--ServerSession(21764429)--property eclipselink.jdbc.user is deprecated, property javax.persistence.jdbc.user should be used instead.
    [EL Info]: 2010-09-30 14:07:38.631--ServerSession(21764429)--property eclipselink.jdbc.driver is deprecated, property javax.persistence.jdbc.driver should be used instead.
    [EL Info]: 2010-09-30 14:07:38.632--ServerSession(21764429)--property eclipselink.jdbc.url is deprecated, property javax.persistence.jdbc.url should be used instead.
    [EL Info]: 2010-09-30 14:07:38.632--ServerSession(21764429)--property eclipselink.jdbc.password is deprecated, property javax.persistence.jdbc.password should be used instead.
    Exception in thread "main" Local Exception Stack:
    Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
    Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@11b86e7
    Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException
    Exception Description: Predeployment of PersistenceUnit [modeliser] failed.
    Internal Exception: Exception [EclipseLink-7214] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: The target entity of the relationship attribute [idClient] on the class [class com.team.formation.model.CommandeTest] cannot be determined. When not using generics, ensure the target entity is defined on the relationship mapping.
    at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:136)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:65)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
    at com.team.formation.model.test.JpersistenceTest.initEntityManager(JpersistenceTest.java:37)
    at com.team.formation.model.test.JpersistenceTest.main(JpersistenceTest.java:28)
    Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException
    Exception Description: Predeployment of PersistenceUnit [modeliser] failed.
    Internal Exception: Exception [EclipseLink-7214] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: The target entity of the relationship attribute [idClient] on the class [class com.team.formation.model.CommandeTest] cannot be determined. When not using generics, ensure the target entity is defined on the relationship mapping.
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1005)
    at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:88)
    at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:127)
    ... 5 more
    Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.EntityManagerSetupException
    Exception Description: Predeployment of PersistenceUnit [modeliser] failed.
    Internal Exception: Exception [EclipseLink-7214] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: The target entity of the relationship attribute [idClient] on the class [class com.team.formation.model.CommandeTest] cannot be determined. When not using generics, ensure the target entity is defined on the relationship mapping.
    at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:210)
    ... 8 more
    Caused by: Exception [EclipseLink-7214] (Eclipse Persistence Services - 2.1.1.v20100817-r8050): org.eclipse.persistence.exceptions.ValidationException
    Exception Description: The target entity of the relationship attribute [idClient] on the class [class com.team.formation.model.CommandeTest] cannot be determined. When not using generics, ensure the target entity is defined on the relationship mapping.
    at org.eclipse.persistence.exceptions.ValidationException.unableToDetermineTargetEntity(ValidationException.java:1967)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.CollectionAccessor.getReferenceClass(CollectionAccessor.java:472)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.addAccessor(ClassAccessor.java:221)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.addAccessorFields(ClassAccessor.java:359)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.addAccessors(ClassAccessor.java:331)
    at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.preProcess(EntityAccessor.java:593)
    at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage1(MetadataProject.java:1494)
    at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:473)
    at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:441)
    at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:959)
    ... 7 more
    Que me proposiez-vous pour remédier à cette situation?

Discussions similaires

  1. Modification concurrente ? JPA, MySQL, tomcat, EclipseLink
    Par bricecol dans le forum Tomcat et TomEE
    Réponses: 0
    Dernier message: 24/05/2011, 09h52
  2. Connection MySQL (Eclipse, Tomcat)
    Par soft-war dans le forum JDBC
    Réponses: 1
    Dernier message: 31/05/2009, 11h52
  3. spring test with jpa-mysql-hibernate.
    Par kossistus dans le forum Spring
    Réponses: 1
    Dernier message: 09/05/2008, 00h28
  4. driver Mysql pour Tomcat
    Par ronic dans le forum NetBeans
    Réponses: 1
    Dernier message: 15/05/2007, 15h26
  5. pb connexion mysql avec tomcat 4
    Par dietrich dans le forum Tomcat et TomEE
    Réponses: 5
    Dernier message: 19/01/2006, 14h45

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo