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

Hibernate Java Discussion :

Erreur "user lacks privilege or object not found: PERSONNES_BENEVOLAT"


Sujet :

Hibernate Java

  1. #1
    Membre expérimenté

    Homme Profil pro
    Senior Développeur JEE
    Inscrit en
    Avril 2002
    Messages
    795
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Belgique

    Informations professionnelles :
    Activité : Senior Développeur JEE
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2002
    Messages : 795
    Points : 1 660
    Points
    1 660
    Par défaut Erreur "user lacks privilege or object not found: PERSONNES_BENEVOLAT"
    Bonjour,

    j'ai un soucis en tentant de migrer l'implémentation JPA d'eclipselink vers hibernate.

    Je tiens à préciser que ça fonctionne sans aucun soucis avec Eclipselink.

    J'ai deux entités Personne et Benevolat.

    J'ai une relation @OneToMany et @JoinColumn entre les deux entités.

    Au niveau DB j'ai deux tables qui représentent chaque entité.

    Comme l'entité n'est plus managée, je la merge. (Chose bizarre car je ne dois rien faire avec Eclipselink, car mon objet est toujours managé, mais peut-être dois-je jouer avec le cache de niveau 2, mais ça s'est une autre histoire. ).

    Et c'est là que le problème survient. Je ne sais pour quelle raison, il recherche une table ayant comme nom 'PERSONNES_BENEVOLAT', table qui bien évidemment n'existe pas dans mon modèle.

    voici mon 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
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.0"
    	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="
            <a href="http://java.sun.com/xml/ns/persistence" target="_blank">http://java.sun.com/xml/ns/persistence</a>
            http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    	<persistence-unit name="StandardNaastPeristenceUnit" transaction-type="JTA">
    		<provider>org.hibernate.ejb.HibernatePersistence</provider>
    		<jta-data-source>java:jboss/datasources/StandardNaastDS</jta-data-source>
    		<class>standardNaast.entities.Abonnement</class>
    		<class>standardNaast.entities.Personne</class>
    		<class>standardNaast.entities.Season</class>
    		<class>standardNaast.entities.Benevolat</class>
    		<class>standardNaast.entities.Cotisation</class>
    		<class>standardNaast.entities.Bloc</class>
    		<class>standardNaast.entities.CommandePlace</class>
    		<class>standardNaast.entities.Team</class>
    		<class>standardNaast.entities.Match</class>
    		<class>standardNaast.entities.PersonneCotisation</class>
    		<class>standardNaast.entities.PersonnesMatch</class>
    		<class>standardNaast.entities.PersonnesMatchPK</class>
    		<class>standardNaast.entities.Travel</class>
    		<class>standardNaast.entities.PrixPlace</class>
    		<class>standardNaast.entities.SaisonEquipe</class>
    		<class>standardNaast.entities.TypeCompetition</class>
    		<class>standardNaast.entities.TypeMatch</class>
    		<class>standardNaast.entities.TypePersonne</class>
    		<class>standardNaast.entities.PersonnesCotisationsId</class>
    		<properties>
    			<property name="hibernate.show_sql" value="true" />
    			<property name="format_sql" value="true"/>
    		</properties>
    	</persistence-unit>
    </persistence>

    Mon entité Personne

    Code java : 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
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    @Entity
    @Table(name = "PERSONNES")
    @Access(AccessType.FIELD)
    public class Personne implements Serializable, Comparable<Personne> {
     
    	private static final long serialVersionUID = -8863656538935308776L;
     
    	public static final int NAME_MAX_LENGTH = 50;
     
    	public static final int EMAIL_MAX_LENGTH = 120;
     
    	public static final int ADDRESS_MAX_LENGTH = 120;
     
    	public static final int PHONE_MAX_LENGTH = 10;
     
    	public static final int POSTAL_CODE_MAX_LENGTH = 4;
     
    	public static final int MEMBER_NUMBER_MAX_LENGTH = 4;
     
    	@Id
    	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "PERSONNES_SEQ")
    	@SequenceGenerator(name = "PERSONNES_SEQ", sequenceName = "PERSONNES_SEQ")
    	@Column(name = "PERSONNE_ID")
    	private long personneId;
     
    	@Column(name = "NOM", length = Personne.NAME_MAX_LENGTH)
    	private String name;
     
    	@Column(name = "PRENOM", length = Personne.NAME_MAX_LENGTH)
    	private String firstname;
     
    	@Column(name = "ADRESSE", length = Personne.ADDRESS_MAX_LENGTH)
    	private String address;
     
    	@Column(name = "CODE_POSTAL", length = Personne.POSTAL_CODE_MAX_LENGTH)
    	private String postalCode;
     
    	@Column(name = "VILLE")
    	private String city;
     
    	@Column(name = "DATE_NAISSANCE")
    	@Temporal(TemporalType.DATE)
    	private Date birthdate;
     
    	@Column(name = "EMAIL", length = Personne.EMAIL_MAX_LENGTH)
    	private String email;
     
    	@Column(name = "GSM", length = Personne.PHONE_MAX_LENGTH)
    	private String mobilePhone;
     
    	@Column(name = "TELEPHONE", length = Personne.PHONE_MAX_LENGTH)
    	private String phone;
     
    	@Column(name = "VALIDITE_CARTE_IDENTITE")
    	@Temporal(TemporalType.DATE)
    	private Date passportValidity;
     
    	@Column(name = "CARTE_IDENTITE")
    	private String identityCardNumber;
     
    	@OneToMany(mappedBy = "personne")
    	private List<Abonnement> abonnementList;
     
    	@OneToMany(cascade = { CascadeType.MERGE, CascadeType.PERSIST }, orphanRemoval = true)
    	private List<Benevolat> benevolatList;
     
    	@OneToMany(mappedBy = "personne", cascade = CascadeType.ALL)
    	private List<PersonneCotisation> personnesCotisations;
     
    	@Column(name = "NUMERO_MEMBRE")
    	private long memberNumber;
     
    	@Column(name = "ETUDIANT")
    	private Boolean student;
     
    	@OneToMany(cascade = CascadeType.ALL, mappedBy = "personne")
    	private Collection<PersonnesMatch> personnesMatchCollection;
     
    	@OneToMany(cascade = CascadeType.ALL, mappedBy = "personne")
    	private Collection<CommandePlace> commandePlaceCollection;
     
    	public long getPersonneId() {
    		return this.personneId;
    	}
     
    	public void setPersonneId(final long personneId) {
    		this.personneId = personneId;
    	}
     
    	public String getName() {
    		return this.name;
    	}
     
    	public void setName(final String name) {
    		this.name = name;
    	}
     
    	public String getFirstname() {
    		return this.firstname;
    	}
     
    	public void setFirstname(final String firstname) {
    		this.firstname = firstname;
    	}
     
    	public String getAddress() {
    		return this.address;
    	}
     
    	public void setAddress(final String address) {
    		this.address = address;
    	}
     
    	public String getPostalCode() {
    		return this.postalCode;
    	}
     
    	public void setPostalCode(final String postalCode) {
    		this.postalCode = postalCode;
    	}
     
    	public String getCity() {
    		return this.city;
    	}
     
    	public void setCity(final String city) {
    		this.city = city;
    	}
     
    	public Date getBirthdate() {
    		return this.birthdate;
    	}
     
    	public void setBirthdate(final Date birthdate) {
    		this.birthdate = birthdate;
    	}
     
    	public String getEmail() {
    		return this.email;
    	}
     
    	public void setEmail(final String email) {
    		this.email = email;
    	}
     
    	public Boolean getStudent() {
    		return this.student;
    	}
     
    	public void setStudent(final Boolean student) {
    		this.student = student;
    	}
     
    	public String getMobilePhone() {
    		return this.mobilePhone;
    	}
     
    	public void setMobilePhone(final String mobilePhone) {
    		this.mobilePhone = mobilePhone;
    	}
     
    	public String getPhone() {
    		return this.phone;
    	}
     
    	public void setPhone(final String phone) {
    		this.phone = phone;
    	}
     
    	public Date getPassportValidity() {
    		return this.passportValidity;
    	}
     
    	public void setPassportValidity(final Date passportValidity) {
    		this.passportValidity = passportValidity;
    	}
     
    	public String getIdentityCardNumber() {
    		return this.identityCardNumber;
    	}
     
    	public void setIdentityCardNumber(final String identityCardNumber) {
    		this.identityCardNumber = identityCardNumber;
    	}
     
    	public long getMemberNumber() {
    		return this.memberNumber;
    	}
     
    	public void setMemberNumber(final long memberNumber) {
    		this.memberNumber = memberNumber;
    	}
     
    	public List<Abonnement> getAbonnementList() {
    		return this.abonnementList;
    	}
     
    	public void setAbonnementList(final List<Abonnement> abonnementList) {
    		this.abonnementList = abonnementList;
    	}
     
    	public List<Benevolat> getBenevolatList() {
    		return this.benevolatList;
    	}
     
    	public void setBenevolatList(final List<Benevolat> benevolatList) {
    		this.benevolatList = benevolatList;
    	}
     
    	public List<PersonneCotisation> getPersonnesCotisations() {
    		return this.personnesCotisations;
    	}
     
    	public void setPersonnesCotisations(
    			final List<PersonneCotisation> personnesCotisations) {
    		this.personnesCotisations = personnesCotisations;
    	}
     
    	@Override
    	public int compareTo(final Personne otherPerson) {
    		long memberNumber1 = this.getMemberNumber();
    		long memberNumber2 = otherPerson.getMemberNumber();
    		return (memberNumber1 < memberNumber2 ? -1
    				: (memberNumber1 == memberNumber2 ? 0 : 1));
    	}
     
    	public Personne() {
    	}
     
    	public Collection<PersonnesMatch> getPersonnesMatchCollection() {
    		return this.personnesMatchCollection;
    	}
     
    	public void setPersonnesMatchCollection(
    			final Collection<PersonnesMatch> personnesMatchCollection) {
    		this.personnesMatchCollection = personnesMatchCollection;
    	}
     
    	public Collection<CommandePlace> getCommandePlaceCollection() {
    		return this.commandePlaceCollection;
    	}
     
    	public void setCommandePlaceCollection(
    			final Collection<CommandePlace> commandePlaceCollection) {
    		this.commandePlaceCollection = commandePlaceCollection;
    	}
    }

    Et mon entité Benevolat

    Code java : 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
    @Entity
    @Table(name = "BENEVOLAT")
    @Access(AccessType.FIELD)
    public class Benevolat implements Serializable {
     
    	@Column(name = "MONTANT")
    	private BigDecimal amount;
     
    	private static final long serialVersionUID = -8943541843276215272L;
     
    	@Id
    	@SequenceGenerator(name = "Benevolat_Sequence_Generator", sequenceName = "BENEVOLAT_SEQ")
    	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "Benevolat_Sequence_Generator")
    	@Column(name = "BENEVOLAT_ID")
    	private long id;
     
    	@Column(name = "DATE_BENEVOLAT")
    	@Temporal(TemporalType.DATE)
    	private Date dateBenevolat;
     
    	@Column(name = "TYPE_BENEVOLAT")
    	private String typeBenevolat;
     
    	@ManyToOne
    	@JoinColumn(name = "PERSONNE_ID")
    	private Personne personne;
     
    	public Date getDateBenevolat() {
    		return this.dateBenevolat;
    	}
     
    	public void setDateBenevolat(final Date dateBenevolat) {
    		this.dateBenevolat = dateBenevolat;
    	}
     
    	public BigDecimal getAmount() {
    		return this.amount;
    	}
     
    	public void setAmount(final BigDecimal amount) {
    		this.amount = amount;
    	}
     
    	public String getTypeBenevolat() {
    		return this.typeBenevolat;
    	}
     
    	public void setTypeBenevolat(final String typeBenevolat) {
    		this.typeBenevolat = typeBenevolat;
    	}
     
    	public Personne getPersonne() {
    		return this.personne;
    	}
     
    	public void setPersonne(final Personne personne) {
    		this.personne = personne;
    	}
     
    	public long getId() {
    		return this.id;
    	}
     
    }

    Voilà où j'en suis.

    Merci d'avance pour votre aide.
    Langages : Java, SQL
    Outils : Eclipse, Intellij
    SGBD : Oracle, PostgreSQL
    Mes Articles

  2. #2
    Membre expérimenté

    Homme Profil pro
    Senior Développeur JEE
    Inscrit en
    Avril 2002
    Messages
    795
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Belgique

    Informations professionnelles :
    Activité : Senior Développeur JEE
    Secteur : Finance

    Informations forums :
    Inscription : Avril 2002
    Messages : 795
    Points : 1 660
    Points
    1 660
    Par défaut
    Solution trouvée en ajoutant simplement le paramètre "mappedBy" dans l'annotation oneToMany.
    Langages : Java, SQL
    Outils : Eclipse, Intellij
    SGBD : Oracle, PostgreSQL
    Mes Articles

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Erreur "Gson class "com.google.gson.Gson" not found"
    Par janyoura dans le forum Android
    Réponses: 1
    Dernier message: 25/12/2012, 14h54
  2. Object not found: SYSTEM_TABLE_CONSTRAINTS
    Par pcouas dans le forum Autres SGBD
    Réponses: 1
    Dernier message: 15/07/2012, 10h41
  3. erreur dans le bios: boot: primary partition not found
    Par Balbuzard dans le forum Administration système
    Réponses: 1
    Dernier message: 09/12/2009, 10h44
  4. Réponses: 3
    Dernier message: 19/11/2008, 19h12
  5. Réponses: 3
    Dernier message: 23/05/2007, 10h43

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