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

Spring Web Java Discussion :

INNER JOIN HQL Hibernate @joinColumn @ManyToOne EntityManager & SessionFactory


Sujet :

Spring Web Java

  1. #1
    Candidat au Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Décembre 2019
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Santé

    Informations forums :
    Inscription : Décembre 2019
    Messages : 4
    Points : 3
    Points
    3
    Par défaut INNER JOIN HQL Hibernate @joinColumn @ManyToOne EntityManager & SessionFactory
    Bonjour à tous,

    Cela fait déjà quelques jours que je bloque sur cette erreur, je fais donc appel à vous.

    J'essaye d'effectuer une requête INNER JOIN pour récupérer une liste de patients en fonction d'un identifiant médecin rentré depuis un formulaire de login.

    J'ai d'abord essayer directement avec ma DAO avant de reporter ma requête vers un jUnit Test Case.

    Ayant trouvé sur des forums qu'il était nécessaire de mapper les deux classes que j'utilise dans mon innerJoin avec des annotations et que l'un des objets ait un champ du type de l'autre objet,

    j'ai changé mon champ rpps(identifiant médecin) dans ma classe Patient en objet HealthcareProvider et j'ai ajouté les deux annotations : @ManyToOne et @JoinColumn(name="RPPS") à ce champ.

    De l'autre côté, j'ai ajouté un champ List<Patient> à ma classe HealthcareProvider comme trouvé sur les différents forums où je suis passé, qui n'est donc pas dans la table des médecins mappée à ma classe.

    Après plusieurs essais échoués avec l'objet SessionFactory, j'ai essayé d'utiliser l'objet EntityManager et bien que ma requête ne crashe pas et ne renvoie pas d'erreur, le résultat est à priori null.

    Voici mes deux classes Patient et HealthcareProvider :

    Je remercie d'avance tous ceux qui voudraient bien m'apporter une aide.

    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
    package com.spring.mvc.component;
     
    import java.time.LocalDateTime;
    import java.util.List;
    import javax.persistence.CascadeType;
    import javax.persistence.Column;
    import javax.persistence.Embedded;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToMany;
    import javax.persistence.ManyToOne;
    import javax.persistence.OneToOne;
    import javax.persistence.Table;
    import org.hibernate.annotations.Fetch;
    import org.hibernate.annotations.FetchMode;
    import org.hibernate.annotations.Formula;
     
    @Entity
    @Table(name = "patients")
    public class Patient {
     
    	@Column(name = "nom")
    	private String nom;
     
    	@Column(name = "prenom")
    	private String prenom;
     
    	@Column(name = "Date_de_naissance")
    	private LocalDateTime date_de_naissance;
     
    	@Column(name = "Adresse")
    	private String adresse;
     
    	@Column(name = "Code_postal")
    	private String code_postal;
     
    	@Column(name = "Ville")
    	private String ville;
     
    	@Column(name = "Sexe")
    	private String sexe;
     
    	@Id
    	@Column(name = "NIR")
    	private String nir;
     
    	@Column(name = "Diagnostic")
    	private Integer diagnostic;
     
    	//@Column(name = "Medecin")
    	//private String medecin;
     
    	/*@ManyToOne( cascade = CascadeType.REFRESH, optional=true)
    	@JoinColumn(name = "RPPS", insertable = false, updatable = false)
    	@Fetch(FetchMode.JOIN)*/
     
    	/*@ManyToOne(cascade = CascadeType.REFRESH, optional=true)
    	@JoinColumn(name = "RPPS", insertable = false, updatable = false)
    	@Fetch(FetchMode.JOIN)  */
     
    	//@ManyToOne(fetch = FetchType.EAGER)
    	@ManyToOne
    	@JoinColumn(name="RPPS")
    	private HealthcareProvider medecin;
     
    	@Column(name = "Communes_Code_postal")
    	private String communes_code_postal;
     
    	public Patient() {}
     
    	public Patient(String nom, String prenom, LocalDateTime date_de_naissance, String adresse, String code_postal,
    			String ville, String sexe, String nir, Integer diagnostic, HealthcareProvider medecin,
    			String communes_code_postal) {
    		super();
    		this.nom = nom;
    		this.prenom = prenom;
    		this.date_de_naissance = date_de_naissance;
    		this.adresse = adresse;
    		this.code_postal = code_postal;
    		this.ville = ville;
    		this.sexe = sexe;
    		this.nir = nir;
    		this.diagnostic = diagnostic;
    		this.medecin = medecin;
    		this.communes_code_postal = communes_code_postal;
    	}
     
    	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 LocalDateTime getDate_de_naissance() {
    		return date_de_naissance;
    	}
     
    	public void setDate_de_naissance(LocalDateTime date_de_naissance) {
    		this.date_de_naissance = date_de_naissance;
    	}
     
    	public String getAdresse() {
    		return adresse;
    	}
     
    	public void setAdresse(String adresse) {
    		this.adresse = adresse;
    	}
     
    	public String getCode_postal() {
    		return code_postal;
    	}
     
    	public void setCode_postal(String code_postal) {
    		this.code_postal = code_postal;
    	}
     
    	public String getVille() {
    		return ville;
    	}
     
    	public void setVille(String ville) {
    		this.ville = ville;
    	}
     
    	public String getSexe() {
    		return sexe;
    	}
     
    	public void setSexe(String sexe) {
    		this.sexe = sexe;
    	}
     
    	public String getNir() {
    		return nir;
    	}
     
    	public void setNir(String nir) {
    		this.nir = nir;
    	}
     
    	public Integer getDiagnostic() {
    		return diagnostic;
    	}
     
    	public void setDiagnostic(Integer diagnostic) {
    		this.diagnostic = diagnostic;
    	}
     
    	public HealthcareProvider getMedecin() {
    		return medecin;
    	}
     
    	public void setMedecin(HealthcareProvider medecin) {
    		this.medecin = medecin;
    	}
     
    	public String getCommunes_code_postal() {
    		return communes_code_postal;
    	}
     
    	public void setCommunes_code_postal(String communes_code_postal) {
    		this.communes_code_postal = communes_code_postal;
    	}
     
    	@Override
    	public String toString() {
    		return "Patient [nom=" + nom + ", prenom=" + prenom + ", date_de_naissance=" + date_de_naissance + ", adresse="
    				+ adresse + ", code_postal=" + code_postal + ", ville=" + ville + ", sexe=" + sexe + ", nir=" + nir
    				+ ", diagnostic=" + diagnostic + ", medecin=" + medecin + ", communes_code_postal="
    				+ communes_code_postal + "]";
    	}
     
    }





    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
    package com.spring.mvc.component;
     
    import java.io.Serializable;
    import java.time.LocalDateTime;
    import java.util.List;
    import javax.persistence.CascadeType;
    import javax.persistence.Column;
    import javax.persistence.Embedded;
    import javax.persistence.Entity;
    import javax.persistence.FetchType;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.JoinColumn;
    import javax.persistence.ManyToMany;
    import javax.persistence.ManyToOne;
    import javax.persistence.OneToMany;
    import javax.persistence.OneToOne;
    import javax.persistence.Table;
    import org.hibernate.annotations.Formula;
     
    @Entity
    @Table(name = "ps")
    public class HealthcareProvider implements Serializable {
     
    	@Column(name = "Nom")
    	private String nom;
     
    	@Column(name = "Prenom")
    	private String prenom;
     
    	@Column(name = "adresse")
    	private String adresse;
     
    	@Column(name = "Code_postal")
    	private String code_postal;
     
    	@Column(name = "Ville")
    	private String ville;
     
    	@Column(name = "Telephone")
    	private String telephone;
     
    	@Column(name = "Portable")
    	private String portable;
     
    	@Column(name = "Mail")
    	private String mail;
     
    	@Column(name = "Communes_Code_postal")
    	private String communes_code_postal;
     
    	@Column(name = "Profession")
    	private String profession;
     
    	//@Formula(value = "SELECT Patients * FROM table patients WHERE patients.Medecin = RPPS")
     
    	//@Formula(value = "SELECT patients.* FROM table patients WHERE patients.Medecin = RPPS")
    	//private List<Patient> patients;
     
    	@Id
    	@Column(name = "RPPS")
    	private String rpps;
     
    	@Column(name = "ADELI")
    	private String adeli;
     
    	/*@OneToMany(mappedBy="patients", cascade=CascadeType.ALL)
    	private List<Patient> patients;*/
     
    	/*@OneToMany(mappedBy = "medecin", cascade=CascadeType.ALL)
    	private List<Patient> patients;*/
     
    	public HealthcareProvider() {}
     
    	public HealthcareProvider(String nom, String prenom, String adresse, String code_postal, String ville,
    			String telephone, String portable, String mail, String communes_code_postal, String profession, String rpps,
    			String adeli) {
    		super();
    		this.nom = nom;
    		this.prenom = prenom;
    		this.adresse = adresse;
    		this.code_postal = code_postal;
    		this.ville = ville;
    		this.telephone = telephone;
    		this.portable = portable;
    		this.mail = mail;
    		this.communes_code_postal = communes_code_postal;
    		this.profession = profession;
    		this.rpps = rpps;
    		this.adeli = adeli;
    	}
     
    	/*public List<Patient> getPatients() {
    		return patients;
    	}
     
    	public void setPatients(List<Patient> patients) {
    		this.patients = patients;
    	}*/
     
    	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 getAdresse() {
    		return adresse;
    	}
     
    	public void setAdresse(String adresse) {
    		this.adresse = adresse;
    	}
     
    	public String getCode_postal() {
    		return code_postal;
    	}
     
    	public void setCode_postal(String code_postal) {
    		this.code_postal = code_postal;
    	}
     
    	public String getVille() {
    		return ville;
    	}
     
    	public void setVille(String ville) {
    		this.ville = ville;
    	}
     
    	public String getTelephone() {
    		return telephone;
    	}
     
    	public void setTelephone(String telephone) {
    		this.telephone = telephone;
    	}
     
    	public String getPortable() {
    		return portable;
    	}
     
    	public void setPortable(String portable) {
    		this.portable = portable;
    	}
     
    	public String getMail() {
    		return mail;
    	}
     
    	public void setMail(String mail) {
    		this.mail = mail;
    	}
     
    	public String getCommunes_code_postal() {
    		return communes_code_postal;
    	}
     
    	public void setCommunes_code_postal(String communes_code_postal) {
    		this.communes_code_postal = communes_code_postal;
    	}
     
    	public String getProfession() {
    		return profession;
    	}
     
    	public void setProfession(String profession) {
    		this.profession = profession;
    	}
     
    	public String getRpps() {
    		return rpps;
    	}
     
    	public void setRpps(String rpps) {
    		this.rpps = rpps;
    	}
     
    	public String getAdeli() {
    		return adeli;
    	}
     
    	public void setAdeli(String adeli) {
    		this.adeli = adeli;
    	}
     
    	@Override
    	public String toString() {
    		return "HealthcareProvider [nom=" + nom + ", prenom=" + prenom + ", adresse=" + adresse + ", code_postal="
    				+ code_postal + ", ville=" + ville + ", telephone=" + telephone + ", portable=" + portable + ", mail="
    				+ mail + ", communes_code_postal=" + communes_code_postal + ", profession=" + profession + ", rpps="
    				+ rpps + ", adeli=" + adeli + "]";
    	}
     
    }
    Voici également mon fichier de configuration :

    Code XML : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    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
    <?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:repo="http://www.springframework.org/schema/data/jpa"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xmlns:p="http://www.springframework.org/schema/p"
    	xmlns:jee="http://www.springframework.org/schema/jee"
    	xsi:schemaLocation="http://www.springframework.org/schema/jee 
           					http://www.springframework.org/schema/jee/spring-jee.xsd
           					http://www.springframework.org/schema/beans 
               				http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
               				http://www.springframework.org/schema/context
             				http://www.springframework.org/schema/context/spring-context-3.0.xsd
             				http://www.springframework.org/schema/data/jpa
        					http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
             				http://www.springframework.org/schema/tx
         					http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
     
    	<context:annotation-config />
     
    	<context:property-placeholder location="classpath*:db.properties" />
     
    	<context:component-scan base-package="com.spring" />
     
    	<repo:repositories base-package="com.spring.mvc.repository" />
     
    	<repo:repositories base-package="com.spring.mvc.services" />
     
    	<bean 
    		id="dataSource" 
    		class="org.springframework.jdbc.datasource.DriverManagerDataSource"
        	p:driverClassName="${mysql.driver}"
        	p:url="${mysql.url}"
       	 	p:username="${mysql.user}"
        	p:password="${mysql.password}" />
     
        <bean id="sessionFactory"
    		class="org.springframework.orm.hibernate5.LocalSessionFactoryBean"
    		p:dataSource-ref="dataSource" p:packagesToScan="com.spring.mvc.component">
    		<property name="hibernateProperties">
    			<value>
    				hibernate.show_sql=false
    				hibernate.format_sql=true
    				hibernate.event.merge.entity_copy_observer=allow
    				hibernate.dialect=org.hibernate.dialect.MySQLDialect
    				hibernate.hbm2ddl.auto=update
    			</value>
    		</property>
    	</bean>
     
    	<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
    		<property name="packagesToScan" value="com.spring.mvc.component" />
    		<property name="dataSource" ref="dataSource" />
    		<property name="persistenceUnitName" value="emfUnit" />
     
    		<property name="jpaProperties">
    			<props>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
    			</props>
    		</property>
    		<property name="jpaVendorAdapter">
    			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"></bean>
    		</property>
    	</bean>
     
    	<bean id="patientServiceImpl" class="com.spring.mvc.service.PatientServiceImpl" />
     
    	<bean id="patientDaoImpl" class="com.spring.mvc.repository.PatientDaoImpl" />
     
    	<bean id="patientController" class="com.spring.mvc.controller.PatientController" />
     
    	<bean id="patient" class="com.spring.mvc.component.Patient" />
     
    	<bean id="healthcareProviderServiceImpl" class="com.spring.mvc.service.HealthcareProviderServiceImpl" />
     
    	<bean id="healthcareProviderDaoImpl" class="com.spring.mvc.repository.HealthcareProviderDaoImpl" />
     
    	<bean id="healthcareProviderController" class="com.spring.mvc.controller.HealthcareProviderController" />
     
    	<bean id="healthcareProvider" class="com.spring.mvc.component.HealthcareProvider" />
     
    	<bean id="respiratoryEffortSessionServiceImpl" class="com.spring.mvc.service.RespiratoryEffortSessionServiceImpl" />
     
    	<bean id="respiratoryEffortSessionDaoImpl" class="com.spring.mvc.repository.RespiratoryEffortSessionDaoImpl" />
     
    	<bean id="respiratoryEffortSessionController" class="com.spring.mvc.controller.RespiratoryEffortSessionController" />
     
    	<bean id="respiratoryEffortSession" class="com.spring.mvc.component.RespiratoryEffortSession" />
     
    	<bean id="physiotherapistSessionServiceImpl" class="com.spring.mvc.service.PhysiotherapistSessionServiceImpl" />
     
    	<bean id="physiotherapistDaoImpl" class="com.spring.mvc.repository.PhysiotherapistSessionDaoImpl" />
     
    	<bean id="physiotherapistController" class="com.spring.mvc.controller.PhysiotherapistSessionController" />
     
    	<bean id="physiotherapistSession" class="com.spring.mvc.component.PhysiotherapistSession" />
     
    	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
        	<property name="entityManagerFactory" ref="entityManagerFactory"/>
    	</bean>
     
    	<!--<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
        	<property name="sessionFactory" ref="sessionFactory"/>
    	</bean>-->
     
    	<tx:annotation-driven transaction-manager="transactionManager" />
     
    </beans>

    Voici également ma requête avec l'entityManager :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Query query = entityManager.createQuery("SELECT p FROM Patient p INNER JOIN HealthcareProvider h WHERE p.medecin.rpps = h.rpps");
     
    List<Patient> patients = (List<Patient>) query.getResultList();

  2. #2
    Membre confirmé Avatar de Kazh Du
    Homme Profil pro
    Développeur Java
    Inscrit en
    Novembre 2011
    Messages
    152
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2011
    Messages : 152
    Points : 561
    Points
    561
    Par défaut


    Note : ton problème ne dépend pas de Spring mais d'hibernate, il aurait donc été judicieux de le poster sur ce forum.

    Pour répondre à ta question, HQL ne reconnaît pas l'instruction INNER JOIN et elle n'est de toute manière pas utile.
    Tu as déjà défini le lien entre Patient et HealthcareProvider (avec @ManyToOne), du coup, pas besoin de le redéfinir dans ta requête.

    Tu peux directement faire :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Query query = entityManager.createQuery("FROM Patient p");
     
    List<Patient> patients = (List<Patient>) query.getResultList();
    for (Patient p : patients) {
        System.out.println(p.getMedecin());
    }
    NB : l'instruction SELECT en HQL est souvent redondante si tu n'as qu'une classe dans le FROM et donc peux être omise.

    Si tu souhaites faire un tri sur le médecin, tu peux directement faire appel à lui dans la requête :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Query query = entityManager.createQuery("FROM Patient p WHERE p.medecin.rpps=:rpps");
    Là tu obtiendras tous les patiens du médecin "rpps"
    Merci d'ajouter un sur les tags qui vous ont aidé

  3. #3
    Rédacteur/Modérateur
    Avatar de andry.aime
    Homme Profil pro
    Inscrit en
    Septembre 2007
    Messages
    8 391
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Ile Maurice

    Informations forums :
    Inscription : Septembre 2007
    Messages : 8 391
    Points : 15 059
    Points
    15 059
    Par défaut
    Bonjour,

    Citation Envoyé par Cesar_Harada Voir le message
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    Query query = entityManager.createQuery("SELECT p FROM Patient p INNER JOIN HealthcareProvider h WHERE p.medecin.rpps = h.rpps");
     
    List<Patient> patients = (List<Patient>) query.getResultList();
    Citation Envoyé par Kazh Du Voir le message
    Pour répondre à ta question, HQL ne reconnaît pas l'instruction INNER JOIN et elle n'est de toute manière pas utile.
    C'est du JPA, donc ce n'est pas du HQL mais du JPQL, la requête est donc bien valide, hibernate est ici utilisé comme implémentation du JPA.

    Après on ne sait pas sur l'objectif de sa requête, récupérer quoi par rapport à quoi?

    A+.

  4. #4
    Candidat au Club
    Homme Profil pro
    Développeur Java
    Inscrit en
    Décembre 2019
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 32
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Développeur Java
    Secteur : Santé

    Informations forums :
    Inscription : Décembre 2019
    Messages : 4
    Points : 3
    Points
    3
    Par défaut Merci pour le coup de main.
    Bonjour,

    Je sais que çà arrive très en retard, mais merci à tous les deux pour vos réponses.
    J'ai été amené à laisser de côté ce projet pendant quelques temps, mais je vais reprendre et voir si c'est bien çà.

Discussions similaires

  1. inner join dans hql
    Par scrutin dans le forum Hibernate
    Réponses: 0
    Dernier message: 07/05/2018, 20h10
  2. hibernate inner join
    Par grospatapouf dans le forum Hibernate
    Réponses: 4
    Dernier message: 01/09/2009, 18h33
  3. Mysql Inner join
    Par ..:: Atchoum ::.. dans le forum Requêtes
    Réponses: 3
    Dernier message: 25/10/2007, 12h21
  4. [Hibernate] Inner join dans hibernate
    Par Saloucious dans le forum Hibernate
    Réponses: 3
    Dernier message: 24/08/2005, 09h38
  5. Inner Join & Select
    Par bakaneko dans le forum Langage SQL
    Réponses: 7
    Dernier message: 10/02/2004, 10h48

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