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 :

QuerySyntaxException ( erreur de syntaxe avec hql )


Sujet :

Hibernate Java

  1. #1
    Membre confirmé
    Homme Profil pro
    éléve ingénieur
    Inscrit en
    Mai 2015
    Messages
    75
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : éléve ingénieur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2015
    Messages : 75
    Par défaut QuerySyntaxException ( erreur de syntaxe avec hql )
    Bonjour tout le monde

    je travaille sur une application web avec hibernate et jsf , quand je voulais faire une requette select avec des jointures je reçois 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
     
    GRAVE: line 1:56: unexpected token: where
    GRAVE: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: where near line 1, column 56 [from entity.Vehicule v , entity.Conducteurvehicule cv, where v.immatriculation=cv.immatriculation and cv.dateCessionVehicile is not NULL]
    	at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:31)
    	at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:24)
    	at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:258)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:157)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
    	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
    	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
    	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
    	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
    	at com.sun.proxy.$Proxy261.createQuery(Unknown Source)
    	at model.ConducteurVehiculeDao.disponibles(ConducteurVehiculeDao.java:51)
    	at controller.ConducteurVehiculeController.getAvailable(ConducteurVehiculeController.java:39)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at javax.el.BeanELResolver.getValue(BeanELResolver.java:363)
    	at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
    	at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
    	at com.sun.el.parser.AstValue.getValue(AstValue.java:138)
    	at com.sun.el.parser.AstValue.getValue(AstValue.java:183)
    	at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224)
    	at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
    	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)
    	at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)
    	at javax.faces.component.UISelectItems.getValue(UISelectItems.java:129)
    	at org.primefaces.renderkit.InputRenderer.getSelectItems(InputRenderer.java:54)
    	at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeMarkup(SelectOneMenuRenderer.java:73)
    	at org.primefaces.component.selectonemenu.SelectOneMenuRenderer.encodeEnd(SelectOneMenuRenderer.java:67)
    	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    	at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
    	at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:185)
    	at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:129)
    	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
    	at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    	at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:84)
    	at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:71)
    	at org.primefaces.component.dialog.DialogRenderer.encodeContent(DialogRenderer.java:180)
    	at org.primefaces.component.dialog.DialogRenderer.encodeMarkup(DialogRenderer.java:109)
    	at org.primefaces.component.dialog.DialogRenderer.encodeEnd(DialogRenderer.java:47)
    	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
    	at javax.faces.render.Renderer.encodeChildren(Renderer.java:168)
    	at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
    	at org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    	at org.richfaces.renderkit.html.PanelRenderer.encodeEnd(PanelRenderer.java:181)
    	at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1764)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
    	at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)
    	at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)
    	at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
    	at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
    	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    	at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
    	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
    	at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
    	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
    	at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
    	at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
    	at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
    	at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
    	at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
    	at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
    	at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
    	at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
    	at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
    	at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
    	at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
    	at java.lang.Thread.run(Thread.java:662)
    j'ai trois tables sur ma bd ----> ( véhicule , conducteur et l'association conducteurVehicule )

    j'ai utilisé le Reverse engineering pour générer les classes alors apres cette generation j'ai eu les classes suivantes

    Vehicule et Conducteur et ConducteurVehicule et ConducteurVehiculeID



    voici la méthode que j'ai implmenté :


    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
     
        /* afficher la liste des vehicules disponibles  */
     
         public List<Vehicule> disponibles(){
               Session s = HibernateUtil.getSessionFactory().getCurrentSession();
     
               List<Vehicule> lst = new ArrayList<Vehicule>();
            try{
     
                s.beginTransaction();
        Query q= s.createQuery("from Vehicule v , Conducteurvehicule cv, where v.immatriculation=cv.immatriculation and cv.dateCessionVehicile is not NULL");
     
                    lst=q.list();
                s.getTransaction().commit();
     
            }catch(Exception e){
     
               e.printStackTrace();  
               s.getTransaction().rollback();
            }
            return lst;
            }

  2. #2
    Membre Expert 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
    Par défaut
    salut
    regardes ici:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     Query q= s.createQuery("from Vehicule v , Conducteurvehicule cv, where v.immatriculation=cv.immatriculation and cv.dateCessionVehicile is not NULL");
    devrait plutot etre:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     Query q= s.createQuery("from Vehicule v , Conducteurvehicule cv  where v.immatriculation=cv.immatriculation and cv.dateCessionVehicile is not NULL");
    eric

  3. #3
    Membre confirmé
    Homme Profil pro
    éléve ingénieur
    Inscrit en
    Mai 2015
    Messages
    75
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Maroc

    Informations professionnelles :
    Activité : éléve ingénieur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2015
    Messages : 75
    Par défaut
    Salut


    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
     
     
      /* afficher la liste des vehicules dont la dateCessionVehicile égal à null */
     
         public List<Vehicule> disponibles(){
               Session s = HibernateUtil.getSessionFactory().getCurrentSession();
     
               List<Vehicule> lst = new ArrayList<Vehicule>();
            try{
     
                s.beginTransaction();
        Query q= s.createQuery("from Vehicule v ,Conducteurvehicule cv  where v.immatriculation=cv.immatriculation and cv.dateCessionVehicile is not NULL");
     
                    lst=q.list();
                s.getTransaction().commit();
     
            }catch(Exception e){
     
               e.printStackTrace();  
               s.getTransaction().rollback();
            }
            return lst;
            }

    voici la classe pojo ConducteurVehicule qui est une association entre conducteur et vehicule

    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
     
     
    public class Conducteurvehicule  implements java.io.Serializable {
     
     
         private ConducteurvehiculeId id;
         private Conducteur conducteur;
         private Vehicule vehicule;
         private Date dateCessionVehicile;
     
        public Conducteurvehicule() {
        }
     
     
        public Conducteurvehicule(ConducteurvehiculeId id, Conducteur conducteur, Vehicule vehicule) {
            this.id = id;
            this.conducteur = conducteur;
            this.vehicule = vehicule;
        }
        public Conducteurvehicule(ConducteurvehiculeId id, Conducteur conducteur, Vehicule vehicule, Date dateCessionVehicile) {
           this.id = id;
           this.conducteur = conducteur;
           this.vehicule = vehicule;
           this.dateCessionVehicile = dateCessionVehicile;
        }
     
         @EmbeddedId
     
        @AttributeOverrides( {
            @AttributeOverride(name="immatriculation", column=@Column(name="immatriculation", nullable=false, length=700) ), 
            @AttributeOverride(name="cin", column=@Column(name="cin", nullable=false, length=700) ), 
            @AttributeOverride(name="datePriseVehicule", column=@Column(name="Date_Prise_Vehicule", nullable=false, length=19) ) } )
        public ConducteurvehiculeId getId() {
            return this.id;
        }
     
        public void setId(ConducteurvehiculeId id) {
            this.id = id;
        }
    @ManyToOne(fetch=FetchType.EAGER)
        @JoinColumn(name="cin", nullable=false, insertable=false, updatable=false)
        public Conducteur getConducteur() {
            return this.conducteur;
        }
     
        public void setConducteur(Conducteur conducteur) {
            this.conducteur = conducteur;
        }
    @ManyToOne(fetch=FetchType.EAGER)
        @JoinColumn(name="immatriculation", nullable=false, insertable=false, updatable=false)
        public Vehicule getVehicule() {
            return this.vehicule;
        }
     
        public void setVehicule(Vehicule vehicule) {
            this.vehicule = vehicule;
        }
        @Temporal(TemporalType.TIMESTAMP)
        @Column(name="Date_Cession_Vehicile", length=19)
        public Date getDateCessionVehicile() {
            return this.dateCessionVehicile;
        }
     
        public void setDateCessionVehicile(Date dateCessionVehicile) {
            this.dateCessionVehicile = dateCessionVehicile;
        }
     
    }



    et la classe ConducteurvehiculeId qui a été généré par netbeans et qui contient que les identifiants

    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
     
     
    @Embeddable
    public class ConducteurvehiculeId  implements java.io.Serializable {
     
     
         private String immatriculation;
         private String cin;
         private Date datePriseVehicule;
     
        public ConducteurvehiculeId() {
        }
     
        public ConducteurvehiculeId(String immatriculation, String cin, Date datePriseVehicule) {
           this.immatriculation = immatriculation;
           this.cin = cin;
           this.datePriseVehicule = datePriseVehicule;
        }
     
     
        @Column(name="immatriculation", nullable=false, length=700)
        public String getImmatriculation() {
            return this.immatriculation;
        }
     
        public void setImmatriculation(String immatriculation) {
            this.immatriculation = immatriculation;
        }
     
        @Column(name="cin", nullable=false, length=700)
        public String getCin() {
            return this.cin;
        }
     
        public void setCin(String cin) {
            this.cin = cin;
        }
     
        @Column(name="Date_Prise_Vehicule", nullable=false, length=19)
        @Temporal(javax.persistence.TemporalType.DATE)
        public Date getDatePriseVehicule() {
            return this.datePriseVehicule;
        }
     
        public void setDatePriseVehicule(Date datePriseVehicule) {
            this.datePriseVehicule = datePriseVehicule;
        }
     
     
       public boolean equals(Object other) {
             if ( (this == other ) ) return true;
    		 if ( (other == null ) ) return false;
    		 if ( !(other instanceof ConducteurvehiculeId) ) return false;
    		 ConducteurvehiculeId castOther = ( ConducteurvehiculeId ) other; 
     
    		 return ( (this.getImmatriculation()==castOther.getImmatriculation()) || ( this.getImmatriculation()!=null && castOther.getImmatriculation()!=null && this.getImmatriculation().equals(castOther.getImmatriculation()) ) )
     && ( (this.getCin()==castOther.getCin()) || ( this.getCin()!=null && castOther.getCin()!=null && this.getCin().equals(castOther.getCin()) ) )
     && ( (this.getDatePriseVehicule()==castOther.getDatePriseVehicule()) || ( this.getDatePriseVehicule()!=null && castOther.getDatePriseVehicule()!=null && this.getDatePriseVehicule().equals(castOther.getDatePriseVehicule()) ) );
       }
     
       public int hashCode() {
             int result = 17;
     
             result = 37 * result + ( getImmatriculation() == null ? 0 : this.getImmatriculation().hashCode() );
             result = 37 * result + ( getCin() == null ? 0 : this.getCin().hashCode() );
             result = 37 * result + ( getDatePriseVehicule() == null ? 0 : this.getDatePriseVehicule().hashCode() );
             return result;
       }   
    }

    l'erreur que je reçois

    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
     
    GRAVE: org.hibernate.QueryException: could not resolve property: immatriculation of: entity.Conducteurvehicule [from entity.Vehicule v ,entity.Conducteurvehicule cv  where v.immatriculation=cv.immatriculation and cv.dateCessionVehicile is not NULL]
    	at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:44)
    	at org.hibernate.persister.entity.AbstractPropertyMapping.toType(AbstractPropertyMapping.java:38)
    	at org.hibernate.persister.entity.AbstractEntityPersister.toType(AbstractEntityPersister.java:1358)
    	at org.hibernate.hql.ast.tree.FromElementType.getPropertyType(FromElementType.java:279)
    	at org.hibernate.hql.ast.tree.FromElement.getPropertyType(FromElement.java:386)
    	at org.hibernate.hql.ast.tree.DotNode.getDataType(DotNode.java:566)
    	at org.hibernate.hql.ast.tree.DotNode.prepareLhs(DotNode.java:241)
    	at org.hibernate.hql.ast.tree.DotNode.resolve(DotNode.java:188)
    	at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:94)
    	at org.hibernate.hql.ast.tree.FromReferenceNode.resolve(FromReferenceNode.java:90)
    	at org.hibernate.hql.ast.HqlSqlWalker.resolve(HqlSqlWalker.java:728)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:1216)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.exprOrSubquery(HqlSqlBaseWalker.java:4041)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker.java:3528)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1762)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.java:1687)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.java:776)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:577)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:281)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:229)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:160)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
    	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:72)
    	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
    	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
    	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    	at java.lang.reflect.Method.invoke(Method.java:597)
    	at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
    	at com.sun.proxy.$Proxy167.createQuery(Unknown Source)

  4. #4
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    tu as un id composite dont fait partie l'immatriculation, donc c'est cv.id.immatriculation. En fait il suffit de lire le message d'erreur: " could not resolve property: immatriculation of: entity.Conducteurvehicule " et de se demander où est la propriété que tu veux.

  5. #5
    Membre Expert 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
    Par défaut
    salut,
    dans la classe Conducteurvehicule:
    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
    public class Conducteurvehicule  implements java.io.Serializable {
     
     
         private ConducteurvehiculeId id;
         private Conducteur conducteur;
         private Vehicule vehicule;
         private Date dateCessionVehicile;
     
        public Conducteurvehicule() {
        }
     
     
        public Conducteurvehicule(ConducteurvehiculeId id, Conducteur conducteur, Vehicule vehicule) {
            this.id = id;
            this.conducteur = conducteur;
            this.vehicule = vehicule;
        }
        public Conducteurvehicule(ConducteurvehiculeId id, Conducteur conducteur, Vehicule vehicule, Date dateCessionVehicile) {
           this.id = id;
           this.conducteur = conducteur;
           this.vehicule = vehicule;
           this.dateCessionVehicile = dateCessionVehicile;
        }
     
         @EmbeddedId
     
        @AttributeOverrides( {
            @AttributeOverride(name="immatriculation", column=@Column(name="immatriculation", nullable=false, length=700) ), 
            @AttributeOverride(name="cin", column=@Column(name="cin", nullable=false, length=700) ), 
            @AttributeOverride(name="datePriseVehicule", column=@Column(name="Date_Prise_Vehicule", nullable=false, length=19) ) } )
        public ConducteurvehiculeId getId() {
            return this.id;
        }
     
        public void setId(ConducteurvehiculeId id) {
            this.id = id;
        }
    @ManyToOne(fetch=FetchType.EAGER)
        @JoinColumn(name="cin", nullable=false, insertable=false, updatable=false)
        public Conducteur getConducteur() {
            return this.conducteur;
        }
     
        public void setConducteur(Conducteur conducteur) {
            this.conducteur = conducteur;
        }
    @ManyToOne(fetch=FetchType.EAGER)
        @JoinColumn(name="immatriculation", nullable=false, insertable=false, updatable=false)
        public Vehicule getVehicule() {
            return this.vehicule;
        }
     
        public void setVehicule(Vehicule vehicule) {
            this.vehicule = vehicule;
        }
        @Temporal(TemporalType.TIMESTAMP)
        @Column(name="Date_Cession_Vehicile", length=19)
        public Date getDateCessionVehicile() {
            return this.dateCessionVehicile;
        }
     
        public void setDateCessionVehicile(Date dateCessionVehicile) {
            this.dateCessionVehicile = dateCessionVehicile;
        }
     
    }
    il n´y a pas de propriété c´est pour cela que cette ligne n´est pas juste.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    v.immatriculation=cv.immatriculation
    d´ou l´erreur.

    eric

Discussions similaires

  1. [PHP 4] Erreur de syntaxe avec Implode
    Par jmtrivia dans le forum Langage
    Réponses: 2
    Dernier message: 13/05/2009, 18h43
  2. Gestionnaire d'interruptions : erreur de syntaxe avec l'opcode call
    Par Link/DD dans le forum Programmation d'OS
    Réponses: 7
    Dernier message: 23/01/2008, 17h00
  3. [POO] Erreur de syntaxe avec une classe
    Par sirbaldur dans le forum Langage
    Réponses: 5
    Dernier message: 10/01/2007, 13h30
  4. [Conception] Erreur de syntaxe avec un champ de tableau
    Par lodan dans le forum PHP & Base de données
    Réponses: 6
    Dernier message: 21/09/2006, 11h45
  5. Erreur de syntaxe avec UPDATE
    Par tyarak dans le forum Requêtes
    Réponses: 3
    Dernier message: 01/02/2006, 01h18

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