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 :

Mapping avec une table qui contient 2 clés primaires


Sujet :

Hibernate Java

  1. #1
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2014
    Messages : 16
    Points : 1
    Points
    1
    Par défaut Mapping avec une table qui contient 2 clés primaires
    bonjour,
    j'ai une table role(idRole,nomRole) et une table utilisateur(idUser,nom, pre,login,pwd...)
    la relation est: 1 role peut etre affecter pour * utilisateur
    j'ai utilisée les annotations pour faire le mapping est j'ai eur l'erreur suivante:

    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
     
    sept. 03, 2014 10:37:35 AM org.apache.catalina.core.AprLifecycleListener init
    INFOS: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\sts-3.4.0.RELEASE;;.
    sept. 03, 2014 10:37:35 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    AVERTISSEMENT: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Gestion_administratif v 14_08' did not find a matching property.
    sept. 03, 2014 10:37:35 AM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["http-bio-8080"]
    sept. 03, 2014 10:37:35 AM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["ajp-bio-8009"]
    sept. 03, 2014 10:37:35 AM org.apache.catalina.startup.Catalina load
    INFOS: Initialization processed in 594 ms
    sept. 03, 2014 10:37:35 AM org.apache.catalina.core.StandardService startInternal
    INFOS: Démarrage du service Catalina
    sept. 03, 2014 10:37:35 AM org.apache.catalina.core.StandardEngine startInternal
    INFOS: Starting Servlet Engine: Apache Tomcat/7.0.21
    sept. 03, 2014 10:37:36 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFOS: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1*011] milliseconds.
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
    sept. 03, 2014 10:37:37 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
    sept. 03, 2014 10:37:38 AM org.apache.catalina.core.ApplicationContext log
    INFOS: Initializing Spring root WebApplicationContext
    log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    sept. 03, 2014 10:37:41 AM org.apache.catalina.core.StandardContext listenerStart
    GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [application-context.xml]: Invocation of init method failed; nested exception is org.hibernate.AnnotationException: No identifier specified for entity: rnu.isamm.pfe.model.Role
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1488)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
    	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    	at java.util.concurrent.FutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: org.hibernate.AnnotationException: No identifier specified for entity: rnu.isamm.pfe.model.Role
    	at org.hibernate.cfg.InheritanceState.determineDefaultAccessType(InheritanceState.java:277)
    	at org.hibernate.cfg.InheritanceState.getElementsToProcess(InheritanceState.java:224)
    	at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:664)
    	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processAnnotatedClassesQueue(Configuration.java:3448)
    	at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3402)
    	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1330)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1729)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1547)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1485)
    	... 19 more
     
    sept. 03, 2014 10:37:41 AM com.sun.faces.config.ConfigureListener contextInitialized
    INFOS: Initialisation de Mojarra 2.1.7 (SNAPSHOT 20120206) pour le contexte «/Gestion_formation»
    sept. 03, 2014 10:37:42 AM com.sun.faces.spi.InjectionProviderFactory createInstance
    INFOS: JSF1048 : Présence d’annotations PostConstruct/PreDestroy  Les méthodes de beans gérés marquées avec ces annotations auront des annotations dites traitées.
    sept. 03, 2014 10:37:44 AM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
    INFOS: Running on PrimeFaces 3.4.2
    sept. 03, 2014 10:37:44 AM org.primefaces.extensions.application.PostConstructApplicationEventListener processEvent
    INFOS: Running on PrimeFaces Extensions 0.7.1
    sept. 03, 2014 10:37:44 AM org.apache.catalina.core.StandardContext startInternal
    GRAVE: Error listenerStart
    sept. 03, 2014 10:37:44 AM org.apache.catalina.core.StandardContext startInternal
    GRAVE: Erreur de démarrage du contexte [/Gestion_formation] suite aux erreurs précédentes
    sept. 03, 2014 10:37:44 AM org.apache.catalina.core.ApplicationContext log
    INFOS: Closing Spring root WebApplicationContext
    sept. 03, 2014 10:37:44 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    GRAVE: The web application [/Gestion_formation] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    sept. 03, 2014 10:37:45 AM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["http-bio-8080"]
    sept. 03, 2014 10:37:45 AM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["ajp-bio-8009"]
    sept. 03, 2014 10:37:45 AM org.apache.catalina.startup.Catalina start
    INFOS: Server startup in 9376 ms
    j'ai suivi des tutoriel et j'ai constaté qu'il faut utilsée l'annotation @Embeddable and @EmbeddedId d'ou jai ajouter la table roleName et voila le code des 3 table

    table Role.java
    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
    package rnu.isamm.pfe.model;
     
    import java.util.HashSet;
    import java.util.Set;
     
    import javax.persistence.AttributeOverride;
    import javax.persistence.AttributeOverrides;
    import javax.persistence.CascadeType;
    import javax.persistence.Embeddable;
    import javax.persistence.Embedded;
    import javax.persistence.EmbeddedId;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
     
    import javax.persistence.Column;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;
     
    import org.hibernate.annotations.Proxy;
    @Entity
    @Proxy(lazy=false)
    @Table(name="Role")
    public class Role {
     
    	//private int idr;
     
    @Embedded
    @AttributeOverrides({
        @AttributeOverride(name="idRole", column=@Column(name="idRole")),
        @AttributeOverride(name="nomRole", column=@Column(name="nomRole"))
      })
    private RoleName roleName;
     
     
     
     
    public RoleName getRoleName() {
    	return roleName;
    }
     
    public void setRoleName(RoleName roleName) {
    	this.roleName = roleName;
    }
    	public Role() {
    		super();
    		// TODO Auto-generated constructor stub
    	}
     
     
     
    	@OneToMany(mappedBy="role", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    	Set<Utilisateur> users=new HashSet<Utilisateur>();
     
     
    	public Set<Utilisateur> getUsers() {
    		return users;
    	}
    	public void setUsers(Set<Utilisateur> users) {
    		this.users = users;
    	}
     
     
     
    }
    table utilisateur.java
    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
    package rnu.isamm.pfe.model;
     
    import java.util.HashSet;
    import java.util.List;
    import java.util.Set;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
     
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.validator.ValidatorException;
    import javax.persistence.CascadeType;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType; 
    import javax.persistence.Id;
    import javax.persistence.Inheritance;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;
    import javax.persistence.JoinColumns;
    import org.hibernate.annotations.Proxy;
     
    @Entity
    @Proxy(lazy=false)
    @Table(name="Utilisateur") 
    public class Utilisateur {
     
    	private int idUser;
    	private String nom;
    	private String prenom;
    	private String mail;
    	private String poste;
    	private String cin;
    	private String login;
    	private String pwd; 
     
    	private Administrateur administrateur ;
     
     
    	@ManyToOne(targetEntity=rnu.isamm.pfe.model.Role.class)
        @JoinColumn(name = "roleName",  unique = false, nullable = false, insertable = false, updatable = false)
    	private Role role;
     
     
    	@Id
    	@GeneratedValue(strategy=GenerationType.IDENTITY)  
    	public int getIdUser() {
    		return idUser;
    	}
    	public void setIdUser(int idUser) {
    		this.idUser = idUser;
    	}
     
     
    	public String getNom() {
    		return nom;
    	}
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
    	public String getPrenom() {
    		return prenom;
    	}
    	public void setPrenom(String prenom) {
    		this.prenom = prenom;
    	}
    	public String getMail() {
    		return mail;
    	}
    	public void setMail(String mail) {
    		this.mail = mail;
    	}
    	public String getPoste() {
    		return poste;
    	}
    	public void setPoste(String poste) {
    		this.poste = poste;
    	}
    	public String getCin() {
    		return cin;
    	}
    	public void setCin(String cin) {
    		this.cin = cin;
    	}
     
     
     
     
    	public String getLogin() {
    		return login;
    	}
    	public void setLogin(String login) {
    		this.login = login;
    	}
    	public String getPwd() {
    		return pwd;
    	}
    	public void setPwd(String pwd) {
    		this.pwd = pwd;
    	}
     
     
    	Set<Affectation> ls_affectation=new HashSet<Affectation>();
     
     
    	@OneToMany(mappedBy="user" , cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    	public Set<Affectation> getLs_affectation() {
    		return ls_affectation;
    	}
    	public void setLs_affectation(Set<Affectation> ls_affectation) {
    		this.ls_affectation = ls_affectation;
    	}
     
     
    	Set<Formation> formations=new HashSet<Formation>();
     
    	@OneToMany(mappedBy="user", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    	public Set<Formation> getFormations() {
    		return formations;
    	}
    	public void setFormations(Set<Formation> formations) {
    		this.formations = formations;
    	}
     
    	@ManyToOne(targetEntity=rnu.isamm.pfe.model.Administrateur.class)
    	@JoinColumn(name="idAdminstrateur", nullable=true)
    	public Administrateur getAdministrateur() {
    		return administrateur;
    	}
    	public void setAdministrateur(Administrateur administrateur) {
    		this.administrateur = administrateur;
    	}
     
     
    	public Role getRole() {
    		return role;
    	}
    	public void setRole(Role role) {
    		this.role = role;
    	}
     
     
     
    	public void validateEmail(FacesContext arg0, UIComponent arg1, Object arg2) throws ValidatorException {
    		String email=(String)arg2;
    		Pattern p=Pattern.compile("[a-z]+[.,-_]*[a-z]*@[a-z]+.[a-z]+");
    		Matcher m=p.matcher(email);
    		boolean verif=m.matches();
     
    		if(!verif){
    			//on utilise lorsque on traveille avec une seule languge 
    			throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,"Email invalid", "mail doit etre sous la forme xxx@xx.xx"));
     
     
    		}
     
    	}
     
     
     
     
     
    }
    table RoleName.java
    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
    package rnu.isamm.pfe.model;
     
    import javax.persistence.Embeddable;
    import javax.persistence.Id;
    import javax.persistence.Column;
    @Embeddable
    public class RoleName {
     
     
    private int idRole;
    private String nomRole;
     
     
    @Column(name="idRole")
    public int getIdRole() {
    	return idRole;
    }
    public void setIdRole(int idRole) {
    	this.idRole = idRole;
    }
     
     
    @Column(name="nomRole")
    public String getNomRole() {
    	return nomRole;
    }
    public void setNomRole(String nomRole) {
    	this.nomRole = nomRole;
    }
    public RoleName() {
    	super();
    	// TODO Auto-generated constructor stub
    }
     
     
     
     
    }
    merci de me corriger

  2. #2
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    salut
    As tu essayé:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    @EmbeddedId
    private RoleName roleName;
    Eric

  3. #3
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2014
    Messages : 16
    Points : 1
    Points
    1
    Par défaut
    salut,
    oui j'ai deja essayé ça et j'ai eu cette erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Caused by: org.hibernate.MappingException: Foreign key (FK407FDB636000EA5C:Utilisateur [role])) must have same number of columns as the referenced primary key (Role [idRole,nomRole])

  4. #4
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    salut,
    comment as-tu crée ta Table Role dans la base de données?
    Car l´exception te dit exactement ce qui ne va pas.
    Eric

  5. #5
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2014
    Messages : 16
    Points : 1
    Points
    1
    Par défaut
    salut,
    en fait le mapping n'est pas fait, voiçi l'erreur complete:
    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
     
    sept. 04, 2014 11:14:35 AM org.apache.catalina.core.AprLifecycleListener init
    INFOS: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\sts-3.4.0.RELEASE;;.
    sept. 04, 2014 11:14:35 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
    AVERTISSEMENT: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Gestion_administratif v 14_08' did not find a matching property.
    sept. 04, 2014 11:14:35 AM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["http-bio-8080"]
    sept. 04, 2014 11:14:35 AM org.apache.coyote.AbstractProtocol init
    INFOS: Initializing ProtocolHandler ["ajp-bio-8009"]
    sept. 04, 2014 11:14:35 AM org.apache.catalina.startup.Catalina load
    INFOS: Initialization processed in 525 ms
    sept. 04, 2014 11:14:35 AM org.apache.catalina.core.StandardService startInternal
    INFOS: Démarrage du service Catalina
    sept. 04, 2014 11:14:35 AM org.apache.catalina.core.StandardEngine startInternal
    INFOS: Starting Servlet Engine: Apache Tomcat/7.0.21
    sept. 04, 2014 11:14:36 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
    INFOS: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1*063] milliseconds.
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.startup.TaglibUriRule body
    INFOS: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
    sept. 04, 2014 11:14:40 AM org.apache.catalina.core.ApplicationContext log
    INFOS: Initializing Spring root WebApplicationContext
    log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
    log4j:WARN Please initialize the log4j system properly.
    log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
    sept. 04, 2014 11:14:45 AM org.apache.catalina.core.StandardContext listenerStart
    GRAVE: Exception lors de l'envoi de l'évènement contexte initialisé (context initialized) à l'instance de classe d'écoute (listener) org.springframework.web.context.ContextLoaderListener
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [application-context.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: Foreign key (FK407FDB636000EA5C:Utilisateur [role])) must have same number of columns as the referenced primary key (Role [idRole,nomRole])
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1488)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:524)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:608)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    	at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
    	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
    	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
    	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
    	at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
    	at java.util.concurrent.FutureTask.run(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: org.hibernate.MappingException: Foreign key (FK407FDB636000EA5C:Utilisateur [role])) must have same number of columns as the referenced primary key (Role [idRole,nomRole])
    	at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:110)
    	at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:93)
    	at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1706)
    	at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1629)
    	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1344)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1729)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1547)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1485)
    	... 19 more
     
    sept. 04, 2014 11:14:45 AM com.sun.faces.config.ConfigureListener contextInitialized
    INFOS: Initialisation de Mojarra 2.1.7 (SNAPSHOT 20120206) pour le contexte «/Gestion_formation»
    sept. 04, 2014 11:14:46 AM com.sun.faces.spi.InjectionProviderFactory createInstance
    INFOS: JSF1048 : Présence d’annotations PostConstruct/PreDestroy  Les méthodes de beans gérés marquées avec ces annotations auront des annotations dites traitées.
    sept. 04, 2014 11:14:48 AM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
    INFOS: Running on PrimeFaces 3.4.2
    sept. 04, 2014 11:14:48 AM org.primefaces.extensions.application.PostConstructApplicationEventListener processEvent
    INFOS: Running on PrimeFaces Extensions 0.7.1
    sept. 04, 2014 11:14:48 AM org.apache.catalina.core.StandardContext startInternal
    GRAVE: Error listenerStart
    sept. 04, 2014 11:14:48 AM org.apache.catalina.core.StandardContext startInternal
    GRAVE: Erreur de démarrage du contexte [/Gestion_formation] suite aux erreurs précédentes
    sept. 04, 2014 11:14:48 AM org.apache.catalina.core.ApplicationContext log
    INFOS: Closing Spring root WebApplicationContext
    sept. 04, 2014 11:14:48 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    GRAVE: The web application [/Gestion_formation] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    sept. 04, 2014 11:14:48 AM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["http-bio-8080"]
    sept. 04, 2014 11:14:48 AM org.apache.coyote.AbstractProtocol start
    INFOS: Starting ProtocolHandler ["ajp-bio-8009"]
    sept. 04, 2014 11:14:48 AM org.apache.catalina.startup.Catalina start
    INFOS: Server startup in 13037 ms

  6. #6
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    voici le code qui devrait marcher,
    je n´ai pas tout mis, car je vois pas pourquoi

    Role:

    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
     
    /**
     * Entity implementation class for Entity: Role
     * 
     */
    @Entity
    @Table(name = "Role")
    @NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r")
    public class Role implements Serializable {
     
    	private static final long serialVersionUID = 1L;
    	@EmbeddedId
    	private RoleName roleName;
     
    	@OneToMany(mappedBy = "role")
    	List<Utilisateur> utilisateurs = new ArrayList<Utilisateur>();
     
    	public Role() {
    	}
     
    	public RoleName getRoleName() {
    		return roleName;
    	}
     
    	public void setRoleName(RoleName roleName) {
    		this.roleName = roleName;
    	}
     
    	public List<Utilisateur> getUtilisateurs() {
    		return utilisateurs;
    	}
     
    	public void setUtilisateurs(List<Utilisateur> utilisateurs) {
    		this.utilisateurs = utilisateurs;
    	}
     
    }
    Eric

    2. RoleName
    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
     
    @Embeddable
    public class RoleName implements Serializable {
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	@Column(name = "\"idRole\"")
    	private int idRole;
    	@Column(name = "\"nomRole\"")
    	private String nomRole;
     
    	public int getIdRole() {
    		return idRole;
    	}
     
    	public void setIdRole(int idRole) {
    		this.idRole = idRole;
    	}
     
    	public String getNomRole() {
    		return nomRole;
    	}
     
    	public void setNomRole(String nomRole) {
    		this.nomRole = nomRole;
    	}
     
    	public RoleName() {
    	}
     
    	public RoleName(int idRole, String nomRole) {
    		super();
    		this.idRole = idRole;
    		this.nomRole = nomRole;
    	}
     
    	@Override
    	public int hashCode() {
    		final int prime = 31;
    		int result = 1;
    		result = prime * result + idRole;
    		result = prime * result + ((nomRole == null) ? 0 : nomRole.hashCode());
    		return result;
    	}
     
    	@Override
    	public boolean equals(Object obj) {
    		if (this == obj)
    			return true;
    		if (obj == null)
    			return false;
    		if (getClass() != obj.getClass())
    			return false;
    		RoleName other = (RoleName) obj;
    		if (idRole != other.idRole)
    			return false;
    		if (nomRole == null) {
    			if (other.nomRole != null)
    				return false;
    		} else if (!nomRole.equals(other.nomRole))
    			return false;
    		return true;
    	}
     
    }
    3. Utilisateur

    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 = "\"Utilisateur\"")
    @NamedQuery(name = "Utilisateur.findAll", query = "SELECT u FROM Utilisateur u")
    public class Utilisateur implements Serializable {
     
    	@Id
    	@Column(name = "\"idUser\"")
    	private Integer idUser;
    	@Column(name = "\"nom\"")
    	private String nom;
    	@Column(name = "\"prenom\"")
    	private String prenom;
    	@Column(name = "\"mail\"")
    	private String mail;
    	@Column(name = "\"poste\"")
    	private String poste;
    	@Column(name = "\"cin\"")
    	private String cin;
    	@Column(name = "\"login\"")
    	private String login;
    	@Column(name = "\"pwd\"")
    	private String pwd;
    	private static final long serialVersionUID = 1L;
     
    	@ManyToOne
    	@JoinColumns({
    			@JoinColumn(name = "idRole", referencedColumnName = "idRole"),
    			@JoinColumn(name = "nomRole", referencedColumnName = "nomRole") })
    	// @JoinColumn(name = "roleName", unique = false, nullable = false,
    	// insertable = false, updatable = false)
    	private Role role;
     
    	public Utilisateur() {
    	}
     
    	public Integer getIdUse() {
    		return this.idUser;
    	}
     
    	public void setIdUse(Integer idUser) {
    		this.idUser = idUser;
    	}
     
    	public String getNom() {
    		return this.nom;
    	}
     
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
     
    	public String getPrenom() {
    		return this.prenom;
    	}
     
    	public void setPrenom(String prenom) {
    		this.prenom = prenom;
    	}
     
    	public String getMail() {
    		return this.mail;
    	}
     
    	public void setMail(String mail) {
    		this.mail = mail;
    	}
     
    	public String getPoste() {
    		return this.poste;
    	}
     
    	public void setPoste(String poste) {
    		this.poste = poste;
    	}
     
    	public String getCin() {
    		return this.cin;
    	}
     
    	public void setCin(String cin) {
    		this.cin = cin;
    	}
     
    	public String getLogin() {
    		return this.login;
    	}
     
    	public void setLogin(String login) {
    		this.login = login;
    	}
     
    	public String getPwd() {
    		return this.pwd;
    	}
     
    	public void setPwd(String pwd) {
    		this.pwd = pwd;
    	}
     
    }

  7. #7
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2014
    Messages : 16
    Points : 1
    Points
    1
    Par défaut
    Salut Eric,

    j'ai essayé votre code mais aucune table n'est crée dans la base, et j'ai eu cette exception:

    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
    Caused by: org.hibernate.MappingException: Unable to find column with logical name: idRole in org.hibernate.mapping.Table(Role) and its related supertables and secondary tables
    	at org.hibernate.cfg.Ejb3JoinColumn.checkReferencedColumnsType(Ejb3JoinColumn.java:552)
    	at org.hibernate.cfg.BinderHelper.createSyntheticPropertyReference(BinderHelper.java:257)
    	at org.hibernate.cfg.ToOneFkSecondPass.doSecondPass(ToOneFkSecondPass.java:116)
    	at org.hibernate.cfg.Configuration.processEndOfQueue(Configuration.java:1514)
    	at org.hibernate.cfg.Configuration.processFkSecondPassInOrder(Configuration.java:1435)
    	at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1340)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1729)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1780)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:247)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:373)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:358)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1547)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1485)
    	... 19 more

  8. #8
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    il ya sans doute quelque chose qui ne passe pas bien:
    peux-tu nous montrer tes nouvelles entitées?

    Merci

    Eric

  9. #9
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2014
    Messages : 16
    Points : 1
    Points
    1
    Par défaut
    Salut,

    plus précisement voila le code en detail:
    Role.java
    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
    package rnu.isamm.pfe.model;
     
     
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
     
    import javax.persistence.EmbeddedId;
    import javax.persistence.Entity;
    import javax.persistence.NamedQuery;
    import javax.persistence.Table;
    import javax.persistence.OneToMany;
     
    @Entity
    @Table(name = "Role")
    @NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r")
    public class Role implements Serializable {
     
    	private static final long serialVersionUID = 1L;
    	@EmbeddedId
    	private RoleName roleName;
     
    	@OneToMany(mappedBy = "role")
    	List<Utilisateur> utilisateurs = new ArrayList<Utilisateur>();
     
    	public Role() {
    	}
     
    	public RoleName getRoleName() {
    		return roleName;
    	}
     
    	public void setRoleName(RoleName roleName) {
    		this.roleName = roleName;
    	}
     
    	public List<Utilisateur> getUtilisateurs() {
    		return utilisateurs;
    	}
     
    	public void setUtilisateurs(List<Utilisateur> utilisateurs) {
    		this.utilisateurs = utilisateurs;
    	}
     
    }
    Utilisateur.java

    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
    194
    195
    package rnu.isamm.pfe.model;
     
    import java.io.Serializable;
    import java.util.HashSet;
    import java.util.List;
    import java.util.Set;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
     
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.validator.ValidatorException;
    import javax.persistence.CascadeType;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType; 
    import javax.persistence.Id;
    import javax.persistence.Inheritance;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToOne;
    import javax.persistence.NamedQuery;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;
    import javax.persistence.JoinColumns;
     
    import org.hibernate.annotations.Proxy;
     
     
    @Entity
    @Table(name = "\"Utilisateur\"")
    @NamedQuery(name = "Utilisateur.findAll", query = "SELECT u FROM Utilisateur u")
    public class Utilisateur implements Serializable {
     
    	@Id
    	@Column(name = "\"idUser\"")
    	private Integer idUser;
    	@Column(name = "\"nom\"")
    	private String nom;
    	@Column(name = "\"prenom\"")
    	private String prenom;
    	@Column(name = "\"mail\"")
    	private String mail;
    	@Column(name = "\"poste\"")
    	private String poste;
    	@Column(name = "\"cin\"")
    	private String cin;
    	@Column(name = "\"login\"")
    	private String login;
    	@Column(name = "\"pwd\"")
    	private String pwd;
    	private static final long serialVersionUID = 1L;
     
    	@ManyToOne
    	@JoinColumns({
    			@JoinColumn(name = "idRole", referencedColumnName = "idRole"),
    			@JoinColumn(name = "nomRole", referencedColumnName = "nomRole") })
     
    	private Role role;
     
    	public Utilisateur() {
    	}
     
    	public Integer getIdUser() {
    		return this.idUser;
    	}
     
    	public void setIdUser(Integer idUser) {
    		this.idUser = idUser;
    	}
     
    	public String getNom() {
    		return this.nom;
    	}
     
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
     
    	public String getPrenom() {
    		return this.prenom;
    	}
     
    	public void setPrenom(String prenom) {
    		this.prenom = prenom;
    	}
     
    	public String getMail() {
    		return this.mail;
    	}
     
    	public void setMail(String mail) {
    		this.mail = mail;
    	}
     
    	public String getPoste() {
    		return this.poste;
    	}
     
    	public void setPoste(String poste) {
    		this.poste = poste;
    	}
     
    	public String getCin() {
    		return this.cin;
    	}
     
    	public void setCin(String cin) {
    		this.cin = cin;
    	}
     
    	public String getLogin() {
    		return this.login;
    	}
     
    	public void setLogin(String login) {
    		this.login = login;
    	}
     
    	public String getPwd() {
    		return this.pwd;
    	}
     
    	public void setPwd(String pwd) {
    		this.pwd = pwd;
    	}
     
     
     
     
    	Set<Affectation> ls_affectation=new HashSet<Affectation>();
     
     
    	@OneToMany(mappedBy="user" , cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    	public Set<Affectation> getLs_affectation() {
    		return ls_affectation;
    	}
    	public void setLs_affectation(Set<Affectation> ls_affectation) {
    		this.ls_affectation = ls_affectation;
    	}
     
     
    	Set<Formation> formations=new HashSet<Formation>();
     
    	@OneToMany(mappedBy="user", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    	public Set<Formation> getFormations() {
    		return formations;
    	}
    	public void setFormations(Set<Formation> formations) {
    		this.formations = formations;
    	}
     
     
    	private Administrateur administrateur;
     
    	@ManyToOne(targetEntity=rnu.isamm.pfe.model.Administrateur.class)
    	@JoinColumn(name="idAdminstrateur", nullable=true)
    	public Administrateur getAdministrateur() {
    		return administrateur;
    	}
    	public void setAdministrateur(Administrateur administrateur) {
    		this.administrateur = administrateur;
    	}
     
     
    	public Role getRole() {
    		return role;
    	}
    	public void setRole(Role role) {
    		this.role = role;
    	}
     
     
     
    	public void validateEmail(FacesContext arg0, UIComponent arg1, Object arg2) throws ValidatorException {
    		String email=(String)arg2;
    		Pattern p=Pattern.compile("[a-z]+[.,-_]*[a-z]*@[a-z]+.[a-z]+");
    		Matcher m=p.matcher(email);
    		boolean verif=m.matches();
     
    		if(!verif){
    			//on utilise lorsque on traveille avec une seule languge 
    			throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,"Email invalid", "mail doit etre sous la forme xxx@xx.xx"));
     
     
    		}
     
    	}
     
     
     
     
     
    }
    et RoleName.java

    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
    package rnu.isamm.pfe.model;
     
    import java.io.Serializable;
     
    import javax.persistence.Embeddable;
    import javax.persistence.Id;
    import javax.persistence.Column;
    import javax.persistence.JoinColumn;
     
    @Embeddable
    public class RoleName implements Serializable {
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	@Column(name = "\"idRole\"")
    	private int idRole;
    	@Column(name = "\"nomRole\"")
    	private String nomRole;
     
    	public int getIdRole() {
    		return idRole;
    	}
     
    	public void setIdRole(int idRole) {
    		this.idRole = idRole;
    	}
     
    	public String getNomRole() {
    		return nomRole;
    	}
     
    	public void setNomRole(String nomRole) {
    		this.nomRole = nomRole;
    	}
     
    	public RoleName() {
    	}
     
    	public RoleName(int idRole, String nomRole) {
    		super();
    		this.idRole = idRole;
    		this.nomRole = nomRole;
    	}
     
    	@Override
    	public int hashCode() {
    		final int prime = 31;
    		int result = 1;
    		result = prime * result + idRole;
    		result = prime * result + ((nomRole == null) ? 0 : nomRole.hashCode());
    		return result;
    	}
     
    	@Override
    	public boolean equals(Object obj) {
    		if (this == obj)
    			return true;
    		if (obj == null)
    			return false;
    		if (getClass() != obj.getClass())
    			return false;
    		RoleName other = (RoleName) obj;
    		if (idRole != other.idRole)
    			return false;
    		if (nomRole == null) {
    			if (other.nomRole != null)
    				return false;
    		} else if (!nomRole.equals(other.nomRole))
    			return false;
    		return true;
    	}
     
    }
    merci infinement

  10. #10
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    SALUT;
    J´AVAIS OMIS d´enlever certains caracteres car travaillant SQLite comme Base de données,
    voici ce qui marche bien moi avec comme base de données mysql :


    Role.java
    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
    package rnu.isamm.pfe.model;
     
    import java.io.Serializable;
    import java.util.ArrayList;
    import java.util.List;
     
    import javax.persistence.EmbeddedId;
    import javax.persistence.Entity;
    import javax.persistence.NamedQuery;
    import javax.persistence.OneToMany;
    import javax.persistence.Table;
     
    @Entity
    @Table(name = "Role")
    @NamedQuery(name = "Role.findAll", query = "SELECT r FROM Role r")
    public class Role implements Serializable {
     
    	private static final long serialVersionUID = 1L;
    	@EmbeddedId
    	private RoleName roleName;
     
    	@OneToMany(mappedBy = "role")
    	List<Utilisateur> utilisateurs = new ArrayList<Utilisateur>();
     
    	public Role() {
    	}
     
    	public RoleName getRoleName() {
    		return roleName;
    	}
     
    	public void setRoleName(RoleName roleName) {
    		this.roleName = roleName;
    	}
     
    	public List<Utilisateur> getUtilisateurs() {
    		return utilisateurs;
    	}
     
    	public void setUtilisateurs(List<Utilisateur> utilisateurs) {
    		this.utilisateurs = utilisateurs;
    	}
     
    }
    Utilisateur.java
    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
    package rnu.isamm.pfe.model;
     
    import java.io.Serializable;
     
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.JoinColumns;
    import javax.persistence.ManyToOne;
    import javax.persistence.NamedQuery;
    import javax.persistence.Table;
     
     
    @Entity
    @Table(name = "Utilisateur")
    @NamedQuery(name = "Utilisateur.findAll", query = "SELECT u FROM Utilisateur u")
    public class Utilisateur implements Serializable {
     
    	@Id
    	@Column(name = "idUser")
    	private Integer idUser;
    	@Column(name = "nom")
    	private String nom;
    	@Column(name = "prenom")
    	private String prenom;
    	@Column(name = "mail")
    	private String mail;
    	@Column(name = "poste")
    	private String poste;
    	@Column(name = "cin")
    	private String cin;
    	@Column(name = "login")
    	private String login;
    	@Column(name = "pwd")
    	private String pwd;
    	private static final long serialVersionUID = 1L;
     
    	@ManyToOne
    	@JoinColumns({
    			@JoinColumn(name = "idRole", referencedColumnName = "idRole"),
    			@JoinColumn(name = "nomRole", referencedColumnName = "nomRole") })
    	private Role role;
     
    	public Utilisateur() {
    	}
     
    	public Integer getIdUser() {
    		return this.idUser;
    	}
     
    	public void setIdUser(Integer idUser) {
    		this.idUser = idUser;
    	}
     
    	public String getNom() {
    		return this.nom;
    	}
     
    	public void setNom(String nom) {
    		this.nom = nom;
    	}
     
    	public String getPrenom() {
    		return this.prenom;
    	}
     
    	public void setPrenom(String prenom) {
    		this.prenom = prenom;
    	}
     
    	public String getMail() {
    		return this.mail;
    	}
     
    	public void setMail(String mail) {
    		this.mail = mail;
    	}
     
    	public String getPoste() {
    		return this.poste;
    	}
     
    	public void setPoste(String poste) {
    		this.poste = poste;
    	}
     
    	public String getCin() {
    		return this.cin;
    	}
     
    	public void setCin(String cin) {
    		this.cin = cin;
    	}
     
    	public String getLogin() {
    		return this.login;
    	}
     
    	public void setLogin(String login) {
    		this.login = login;
    	}
     
    	public String getPwd() {
    		return this.pwd;
    	}
     
    	public void setPwd(String pwd) {
    		this.pwd = pwd;
    	}
     
     
     
     
     
     
     
     
     
    	public Role getRole() {
    		return role;
    	}
    	public void setRole(Role role) {
    		this.role = role;
    	}
     
     
     
    //	public void validateEmail(FacesContext arg0, UIComponent arg1, Object arg2) throws ValidatorException {
    //		String email=(String)arg2;
    //		Pattern p=Pattern.compile("[a-z]+[.,-_]*[a-z]*@[a-z]+.[a-z]+");
    //		Matcher m=p.matcher(email);
    //		boolean verif=m.matches();
    // 
    //		if(!verif){
    //			//on utilise lorsque on traveille avec une seule languge 
    //			throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,"Email invalid", "mail doit etre sous la forme xxx@xx.xx"));
    // 
    // 
    //		}
    // 
    //	}
     
     
     
     
     
    }
    RoleName.java
    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
    package rnu.isamm.pfe.model;
     
    import java.io.Serializable;
     
    import javax.persistence.Column;
    import javax.persistence.Embeddable;
     
    @Embeddable
    public class RoleName implements Serializable {
    	/**
             * 
             */
    	private static final long serialVersionUID = 1L;
    	@Column(name = "idRole")
    	private int idRole;
    	@Column(name = "nomRole")
    	private String nomRole;
     
    	public int getIdRole() {
    		return idRole;
    	}
     
    	public void setIdRole(int idRole) {
    		this.idRole = idRole;
    	}
     
    	public String getNomRole() {
    		return nomRole;
    	}
     
    	public void setNomRole(String nomRole) {
    		this.nomRole = nomRole;
    	}
     
    	public RoleName() {
    	}
     
    	public RoleName(int idRole, String nomRole) {
    		super();
    		this.idRole = idRole;
    		this.nomRole = nomRole;
    	}
     
    	@Override
    	public int hashCode() {
    		final int prime = 31;
    		int result = 1;
    		result = prime * result + idRole;
    		result = prime * result + ((nomRole == null) ? 0 : nomRole.hashCode());
    		return result;
    	}
     
    	@Override
    	public boolean equals(Object obj) {
    		if (this == obj)
    			return true;
    		if (obj == null)
    			return false;
    		if (getClass() != obj.getClass())
    			return false;
    		RoleName other = (RoleName) obj;
    		if (idRole != other.idRole)
    			return false;
    		if (nomRole == null) {
    			if (other.nomRole != null)
    				return false;
    		} else if (!nomRole.equals(other.nomRole))
    			return false;
    		return true;
    	}
     
    }
    Eric

  11. #11
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2014
    Messages : 16
    Points : 1
    Points
    1
    Par défaut
    salut,

    aparement que la faute est dans le context-application malgré que ça fonctionne avant que j'ajoute la table RoleName et les annotation de embeddeble

    an fait je travaille avec hibernate4, jsf2 et spring3 sous SpringtoolsSuit3.4 et j'utlise Tomcat7 et Mysql comme BD

    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
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:aop="http://www.springframework.org/schema/aop"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
     
     
    <bean id="dataSource"	class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    	<property name="driverClassName" value="com.mysql.jdbc.Driver" />
    	<property name="url" value="jdbc:mysql://localhost/b" />
    	<property name="username" value="root" />
    	<property name="password" value="" />
    </bean>
     
     
    <bean id="sessionFactory"  class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    	<property name="dataSource" ref="dataSource"/>
    	<property name="annotatedClasses">
      		<list>
                <value>rnu.isamm.pfe.model.Affectation</value>
                <value>rnu.isamm.pfe.model.Administrateur</value>
                <value>rnu.isamm.pfe.model.Classe</value>
                <value>rnu.isamm.pfe.model.Enseignant</value>
    			<value>rnu.isamm.pfe.model.Formation</value>
        	  	<value>rnu.isamm.pfe.model.Matiere</value>
        	  	<value>rnu.isamm.pfe.model.Semestre</value>
        	  	<value>rnu.isamm.pfe.model.UniteEnseignement</value>
        	  	<value>rnu.isamm.pfe.model.Utilisateur</value>
        	  	<value>rnu.isamm.pfe.model.Absence</value>
        	  	<value>rnu.isamm.pfe.model.Salle</value>
        	  	<value>rnu.isamm.pfe.model.Horaire</value>
        	  	<value>rnu.isamm.pfe.model.Planning</value>
        	  	<value>rnu.isamm.pfe.model.Universite</value>
        	  	<value>rnu.isamm.pfe.model.Role</value>
      		</list>
    	</property>
    	<property name="configLocation" value="classpath:hibernate.cfg.xml"/>
    </bean>
     
        <!-- Transaction Manager is defined -->
     <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
           <property name="sessionFactory" ref="sessionFactory"/>
     </bean>
     
        <tx:annotation-driven transaction-manager="transactionManager"/>
        <context:annotation-config/>
        <context:component-scan base-package="rnu.isamm"/>
     
     
     
    </beans>

  12. #12
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    jdbc:mysql://localhost/b
    ne serait pas plutot:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    jdbc:mysql://localhost:3306/b
    eric

  13. #13
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2014
    Messages
    16
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Mars 2014
    Messages : 16
    Points : 1
    Points
    1
    Par défaut
    malheureusement ça marche pas

  14. #14
    Membre chevronné Avatar de jeffray03
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2008
    Messages
    1 501
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Allemagne

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2008
    Messages : 1 501
    Points : 2 120
    Points
    2 120
    Par défaut
    Salut
    mon applicationContext ne contient que ceci:
    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
     
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xsi:schemaLocation="http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-4.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
     
      <context:component-scan base-package="rnu.isamm"/>
    </beans>
    tu ne peux pas annoter tes classes et les mettre encore dans le fichier de configuration.
    Etsi cela ne marce pas alors le plus simple serait de m´envoyer tout ton Projet en Privée et je vois ce qui ne va pas.
    Eric

Discussions similaires

  1. Réponses: 4
    Dernier message: 10/09/2014, 16h04
  2. c:out avec une string qui contient du html
    Par MooGle dans le forum Struts 1
    Réponses: 2
    Dernier message: 28/08/2007, 14h45
  3. Réponses: 1
    Dernier message: 18/07/2007, 11h58
  4. [MySQL] Afficher les entrées d'une table qui contient un mot précis
    Par anarchoi dans le forum PHP & Base de données
    Réponses: 11
    Dernier message: 02/05/2007, 21h15
  5. suppression dans une table qui contient une clé etrangère
    Par zana74 dans le forum Décisions SGBD
    Réponses: 13
    Dernier message: 08/08/2006, 10h58

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