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 :

Hibernate annotation: class not mapped


Sujet :

Hibernate Java

  1. #1
    Membre à l'essai
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 16
    Points
    16
    Par défaut Hibernate annotation: class not mapped
    Bonjour
    je travaille avec hibernate annotation et spring dans une application web.
    J'arrive pas à accéder à la table "Utilisateur"
    l'erreur vient de l'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
    16
    17
    18
    19
    20
    21
    22
    23
    24
     
    GRAVE: org.springframework.orm.hibernate3.HibernateQueryException: Utilisateur is not mapped [from Utilisateur]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Utilisateur is not mapped [from Utilisateur]
    javax.faces.el.EvaluationException: org.springframework.orm.hibernate3.HibernateQueryException: Utilisateur is not mapped [from Utilisateur]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: Utilisateur is not mapped [from Utilisateur]
    	at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
    	at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    	at javax.faces.component.UICommand.broadcast(UICommand.java:387)
    	at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
    	at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
    	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	at java.lang.Thread.run(Unknown Source)
    d'ou vient cette exception selon vous?
    La méthode qui a générer l'exception:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    hibernateTemplate.find("from Utilisateur")
    merci de m'aider

  2. #2
    Membre à l'essai
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 16
    Points
    16
    Par défaut
    J'ai testé toutes les possibilités mais j'ai pas arrivé à résoudre ce problème.
    Toutefois, je pense que le problème vient du mapping entre les attributs de la table (base de données oracle) et ceux de la classe "Utilisateur".
    et précisement des donnees de type "Date"
    dans la base : date de naissance--->23/03/2010
    est ce que ça pose pas des problèmes de mapping?

  3. #3
    Expert confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 274
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 274
    Points : 4 141
    Points
    4 141
    Par défaut
    Montre nous ton mapping de la classe Utiliateur.

  4. #4
    Membre à l'essai
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 16
    Points
    16
    Par défaut
    merci,
    voici la classe "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
    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
     
    package rmtDAObase;
     
    import java.io.Serializable;
    import java.util.Date;
     
    import javax.persistence.Column;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.Table;
    import javax.persistence.Temporal;
    import javax.persistence.TemporalType;
    import javax.persistence.GenerationType;
    import javax.persistence.SequenceGenerator;
     
    import org.hibernate.annotations.Entity;
     
    @Entity
    @Table(name = "UTILISATEUR")
    public class Utilisateur implements Serializable{
     
    	/**
             * 
             */
    	private static final long serialVersionUID = 7755152440767731751L;
    	private Integer Id;
    	private String FirstName;
    	private String LastName;
    	private String Login;
    	private String Passwd;
    	private String Phone1;
    	private String Phone2;
    	private String MobilePhone;
    	private String Email;
    	private Date CreationDate;
    	private String Department;
    	private String Desk;
    	private String Office;
    	private String Active;
    	private Date ExpirationDate;
     
    	public Utilisateur() {
    	}
     
    	public Utilisateur(String Login, String Passwd, String Email) {
    		this.Login = Login;
    		this.Passwd = Passwd;
    		this.Email = Email;
    	}
     
    	public Utilisateur(String FirstName, String LastName, String Login,
    			String Passwd, String Phone1, String Phone2, String MobilePhone,
    			String Email, Date CreationDate, String Department, String Desk,
    			String Office, String Active, Date ExpirationDate) {
    		this.FirstName = FirstName;
    		this.LastName = LastName;
    		this.Login = Login;
    		this.Passwd = Passwd;
    		this.Phone1 = Phone1;
    		this.Phone2 = Phone2;
    		this.MobilePhone = MobilePhone;
    		this.Email = Email;
    		this.CreationDate = CreationDate;
    		this.Department = Department;
    		this.Desk = Desk;
    		this.Office = Office;
    		this.Active = Active;
    		this.ExpirationDate = ExpirationDate;
    	}
     
    	@SequenceGenerator(name = "generator")
    	@Id
    	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "generator")
    	@Column(name = "USER_ID", nullable = false)
    	public Integer getId() {
    		return this.Id;
    	}
     
    	public void setId(Integer Id) {
    		this.Id = Id;
    	}
     
    	@Column(name = "FIRST_NAME")
    	public String getFirstName() {
    		return this.FirstName;
    	}
     
    	public void setFirstName(String FirstName) {
    		this.FirstName = FirstName;
    	}
     
    	@Column(name = "LAST_NAME")
    	public String getLastName() {
    		return this.LastName;
    	}
     
    	public void setLastName(String LastName) {
    		this.LastName = LastName;
    	}
     
    	@Column(name = "LOGIN", nullable = false, length = 25)
    	public String getLogin() {
    		return this.Login;
    	}
     
    	public void setLogin(String Login) {
    		this.Login = Login;
    	}
     
    	@Column(name = "PASSWD", nullable = false, length = 32)
    	public String getPasswd() {
    		return this.Passwd;
    	}
     
    	public void setPasswd(String Passwd) {
    		this.Passwd = Passwd;
    	}
     
    	@Column(name = "PHONE1", length = 20)
    	public String getPhone1() {
    		return this.Phone1;
    	}
     
    	public void setPhone1(String Phone1) {
    		this.Phone1 = Phone1;
    	}
     
    	@Column(name = "PHONE2", length = 20)
    	public String getPhone2() {
    		return this.Phone2;
    	}
     
    	public void setPhone2(String Phone2) {
    		this.Phone2 = Phone2;
    	}
     
    	@Column(name = "MOBILE_PHONE", length = 20)
    	public String getMobilePhone() {
    		return this.MobilePhone;
    	}
     
    	public void setMobilePhone(String MobilePhone) {
    		this.MobilePhone = MobilePhone;
    	}
     
    	@Column(name = "EMAIL", nullable = false, length = 60)
    	public String getEmail() {
    		return this.Email;
    	}
     
    	public void setEmail(String Email) {
    		this.Email = Email;
    	}
     
    	@Temporal(TemporalType.DATE)
    	@Column(name = "CREATION_DATE", length = 7)
    	public Date getCreationDate() {
    		return this.CreationDate;
    	}
     
    	public void setCreationDate(Date CreationDate) {
    		this.CreationDate = CreationDate;
    	}
     
    	@Column(name = "DEPARTMENT")
    	public String getDepartment() {
    		return this.Department;
    	}
     
    	public void setDepartment(String Department) {
    		this.Department = Department;
    	}
     
    	@Column(name = "DESK")
    	public String getDesk() {
    		return this.Desk;
    	}
     
    	public void setDesk(String Desk) {
    		this.Desk = Desk;
    	}
     
    	@Column(name = "OFFICE")
    	public String getOffice() {
    		return this.Office;
    	}
     
    	public void setOffice(String Office) {
    		this.Office = Office;
    	}
     
    	@Column(name = "ACTIVE", length = 1)
    	public String getActive() {
    		return this.Active;
    	}
     
    	public void setActive(String Active) {
    		this.Active = Active;
    	}
     
    	@Temporal(TemporalType.DATE)
    	@Column(name = "EXPIRATION_DATE", length = 7)
    	public Date getExpirationDate() {
    		return this.ExpirationDate;
    	}
     
    	public void setExpirationDate(Date ExpirationDate) {
    		this.ExpirationDate = ExpirationDate;
    	}
     
    }

  5. #5
    Expert confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 274
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 274
    Points : 4 141
    Points
    4 141
    Par défaut
    Et dans ton fichier de conf, tu as déclaré la classe ?

  6. #6
    Membre à l'essai
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 16
    Points
    16
    Par défaut
    oui biensur

  7. #7
    Membre à l'essai
    Inscrit en
    Octobre 2009
    Messages
    27
    Détails du profil
    Informations forums :
    Inscription : Octobre 2009
    Messages : 27
    Points : 16
    Points
    16
    Par défaut
    Sayé j'ai trouvé la solution
    il suffit de mentionner le chemin de la classe de mapping dans la requete "package1.Utilsateur"
    merci fr1man

  8. #8
    Expert confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 274
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 274
    Points : 4 141
    Points
    4 141
    Par défaut
    C'est plutôt à faire dans le fichier de config.
    Ca rendra tes requêtes plus lisibles.

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

Discussions similaires

  1. mapping hibernate annotations avec classe association
    Par amadoulamine1 dans le forum Hibernate
    Réponses: 0
    Dernier message: 07/06/2011, 20h27
  2. Réponses: 5
    Dernier message: 08/05/2009, 18h03
  3. Tomcat hibernate annotation DAO probleme mapping
    Par bibi73 dans le forum Hibernate
    Réponses: 20
    Dernier message: 20/08/2007, 14h40
  4. Connexion IRport et Hibernate (component class not found)
    Par imad.elghazoini dans le forum iReport
    Réponses: 4
    Dernier message: 29/06/2007, 11h51
  5. hibernate problem (classe not mapped)
    Par oughlad dans le forum Hibernate
    Réponses: 11
    Dernier message: 25/06/2007, 19h57

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