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

Eclipse Java Discussion :

Probème d'accès aux donnée JPA avec eclipse


Sujet :

Eclipse Java

  1. #1
    Membre du Club
    Homme Profil pro
    Etudiant
    Inscrit en
    Avril 2016
    Messages
    60
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : Etudiant
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Avril 2016
    Messages : 60
    Points : 58
    Points
    58
    Par défaut Probème d'accès aux donnée JPA avec eclipse
    Bonjour tout le monde, je suis coîncé sur l'accès au donnée dans mon projet JPA. Apres avoir configurer la base de donnée h2 je parvient à executer les requettes sql dans le terminal dédié via eclipse.
    Vous avez ici un exemple d'entité généréé
    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
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    package jPAProject;
     
    import java.io.Serializable;
    import javax.persistence.*;
    import java.util.List;
     
     
    /**
     * The persistent class for the "employees" database table.
     * 
     */
    @Entity
    @Table(name="\"employees\"")
    @NamedQuery(name="Employee.findAll", query="SELECT e FROM Employee e")
    public class Employee implements Serializable {
    	private static final long serialVersionUID = 1L;
     
    	@Id
    	@Column(name="\"id\"")
    	private int id;
     
    	@Column(name="\"address\"")
    	private String address;
     
    	@Lob
    	@Column(name="\"attachments\"")
    	private byte[] attachments;
     
    	@Column(name="\"business_phone\"")
    	private String businessPhone;
     
    	@Column(name="\"city\"")
    	private String city;
     
    	@Column(name="\"company\"")
    	private String company;
     
    	@Column(name="\"country_region\"")
    	private String countryRegion;
     
    	@Column(name="\"email_address\"")
    	private String emailAddress;
     
    	@Column(name="\"fax_number\"")
    	private String faxNumber;
     
    	@Column(name="\"first_name\"")
    	private String firstName;
     
    	@Column(name="\"home_phone\"")
    	private String homePhone;
     
    	@Column(name="\"job_title\"")
    	private String jobTitle;
     
    	@Column(name="\"last_name\"")
    	private String lastName;
     
    	@Column(name="\"mobile_phone\"")
    	private String mobilePhone;
     
    	@Column(name="\"notes\"")
    	private String notes;
     
    	@Column(name="\"state_province\"")
    	private String stateProvince;
     
    	@Column(name="\"web_page\"")
    	private String webPage;
     
    	@Column(name="\"zip_postal_code\"")
    	private String zipPostalCode;
     
    	//bi-directional many-to-one association to Order
    	@OneToMany(mappedBy="employee")
    	private List<Order> orders;
     
    	//bi-directional many-to-many association to Privilege
    	@ManyToMany(mappedBy="employees")
    	private List<Privilege> privileges;
     
    	//bi-directional many-to-one association to PurchaseOrder
    	@OneToMany(mappedBy="employee")
    	private List<PurchaseOrder> purchaseOrders;
     
    	public Employee() {
    	}
     
    	public int getId() {
    		return this.id;
    	}
     
    	public void setId(int id) {
    		this.id = id;
    	}
     
    	public String getAddress() {
    		return this.address;
    	}
     
    	public void setAddress(String address) {
    		this.address = address;
    	}
     
    	public byte[] getAttachments() {
    		return this.attachments;
    	}
     
    	public void setAttachments(byte[] attachments) {
    		this.attachments = attachments;
    	}
     
    	public String getBusinessPhone() {
    		return this.businessPhone;
    	}
     
    	public void setBusinessPhone(String businessPhone) {
    		this.businessPhone = businessPhone;
    	}
     
    	public String getCity() {
    		return this.city;
    	}
     
    	public void setCity(String city) {
    		this.city = city;
    	}
     
    	public String getCompany() {
    		return this.company;
    	}
     
    	public void setCompany(String company) {
    		this.company = company;
    	}
     
    	public String getCountryRegion() {
    		return this.countryRegion;
    	}
     
    	public void setCountryRegion(String countryRegion) {
    		this.countryRegion = countryRegion;
    	}
     
    	public String getEmailAddress() {
    		return this.emailAddress;
    	}
     
    	public void setEmailAddress(String emailAddress) {
    		this.emailAddress = emailAddress;
    	}
     
    	public String getFaxNumber() {
    		return this.faxNumber;
    	}
     
    	public void setFaxNumber(String faxNumber) {
    		this.faxNumber = faxNumber;
    	}
     
    	public String getFirstName() {
    		return this.firstName;
    	}
     
    	public void setFirstName(String firstName) {
    		this.firstName = firstName;
    	}
     
    	public String getHomePhone() {
    		return this.homePhone;
    	}
     
    	public void setHomePhone(String homePhone) {
    		this.homePhone = homePhone;
    	}
     
    	public String getJobTitle() {
    		return this.jobTitle;
    	}
     
    	public void setJobTitle(String jobTitle) {
    		this.jobTitle = jobTitle;
    	}
     
    	public String getLastName() {
    		return this.lastName;
    	}
     
    	public void setLastName(String lastName) {
    		this.lastName = lastName;
    	}
     
    	public String getMobilePhone() {
    		return this.mobilePhone;
    	}
     
    	public void setMobilePhone(String mobilePhone) {
    		this.mobilePhone = mobilePhone;
    	}
     
    	public String getNotes() {
    		return this.notes;
    	}
     
    	public void setNotes(String notes) {
    		this.notes = notes;
    	}
     
    	public String getStateProvince() {
    		return this.stateProvince;
    	}
     
    	public void setStateProvince(String stateProvince) {
    		this.stateProvince = stateProvince;
    	}
     
    	public String getWebPage() {
    		return this.webPage;
    	}
     
    	public void setWebPage(String webPage) {
    		this.webPage = webPage;
    	}
     
    	public String getZipPostalCode() {
    		return this.zipPostalCode;
    	}
     
    	public void setZipPostalCode(String zipPostalCode) {
    		this.zipPostalCode = zipPostalCode;
    	}
     
    	public List<Order> getOrders() {
    		return this.orders;
    	}
     
    	public void setOrders(List<Order> orders) {
    		this.orders = orders;
    	}
     
    	public Order addOrder(Order order) {
    		getOrders().add(order);
    		order.setEmployee(this);
     
    		return order;
    	}
     
    	public Order removeOrder(Order order) {
    		getOrders().remove(order);
    		order.setEmployee(null);
     
    		return order;
    	}
     
    	public List<Privilege> getPrivileges() {
    		return this.privileges;
    	}
     
    	public void setPrivileges(List<Privilege> privileges) {
    		this.privileges = privileges;
    	}
     
    	public List<PurchaseOrder> getPurchaseOrders() {
    		return this.purchaseOrders;
    	}
     
    	public void setPurchaseOrders(List<PurchaseOrder> purchaseOrders) {
    		this.purchaseOrders = purchaseOrders;
    	}
     
    	public PurchaseOrder addPurchaseOrder(PurchaseOrder purchaseOrder) {
    		getPurchaseOrders().add(purchaseOrder);
    		purchaseOrder.setEmployee(this);
     
    		return purchaseOrder;
    	}
     
    	public PurchaseOrder removePurchaseOrder(PurchaseOrder purchaseOrder) {
    		getPurchaseOrders().remove(purchaseOrder);
    		purchaseOrder.setEmployee(null);
     
    		return purchaseOrder;
    	}
    //le main que moi me j'ai ajouté
    	public static void main(String[] args) {
    		EntityManagerFactory emf=Persistence.createEntityManagerFactory("jPAProject");
    		EntityManager em=emf.createEntityManager();
    		Query nQuery = em.createNamedQuery("Employee.findAll",Employee.class);
    		List<Employee> customers = nQuery.getResultList();
    		for(Employee c:customers)
    			System.out.println(c.getLastName());
     
    	}
     
    }
    mon fichier persitence.xml est le suivant:
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
    	<persistence-unit name="jPAProject" transaction-type="RESOURCE_LOCAL">
    	<mapping-file>META-INF/querry.xml</mapping-file>
    	<class>jPAProject.Customer</class>
    	<class>jPAProject.Employee</class>
    	<class>jPAProject.InventoryTransactionType</class>
    	<class>jPAProject.InventoryTransaction</class>
    	<class>jPAProject.Invoice</class>
    	<class>jPAProject.OrderDetail</class>
    	<class>jPAProject.OrderDetailsStatus</class>
    	<class>jPAProject.Order</class>
    	<class>jPAProject.OrdersStatus</class>
    	<class>jPAProject.OrdersTaxStatus</class>
    	<class>jPAProject.Privilege</class>
    	<class>jPAProject.Product</class>
    	<class>jPAProject.PurchaseOrderDetail</class>
    	<class>jPAProject.PurchaseOrderStatus</class>
    	<class>jPAProject.PurchaseOrder</class>
    	<class>jPAProject.SalesReport</class>
    	<class>jPAProject.Shipper</class>
    	<class>jPAProject.Supplier</class>
    		<properties>
    			<property name="javax.persistence.jdbc.url" value="jdbc:h2:/home/sylla/Documents/COURS_L3/ProjetEclipse/northwind;AUTO_SERVER=TRUE"/>
    			<property name="javax.persistence.jdbc.user" value="sa"/>
    			<property name="javax.persistence.jdbc.password" value=""/>
    			<property name="javax.persistence.jdbc.driver" value="org.h2.Driver"/>
    			<property name="eclipselink.logging.level" value="FINE"/>
    			<property name="javax.persistence.logging.level" value="FINE"/>
    			<property name="eclipselink.allow-zero-id" value="true"/>
    		</properties>
    	</persistence-unit>
    </persistence>
    et le fichier pom.xml
    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
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>jPAProject</groupId>
      <artifactId>jPAProject</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.0</version>
            <configuration>
              <source>1.8</source>
              <target>1.8</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <dependencies>
    		<dependency>
    		<groupId>org.eclipse.persistence</groupId>
    		<artifactId>eclipselink</artifactId>
    		<version>2.5.2</version>
    		</dependency>
    		<dependency>
    			<groupId>com.h2database</groupId>
    			<artifactId>h2</artifactId>
    			<version>1.4.199</version>
    		</dependency>
    	</dependencies>
    </project>
    et un screen de l'erreur en sortie

    Error Code: 42102
    Call: SELECT "id", "address", "attachments", "business_phone", "city", "company", "country_region", "email_address", "fax_number", "first_name", "home_phone", "job_title", "last_name", "mobile_phone", "notes", "state_province", "web_page", "zip_postal_code" FROM "employees"
    Query: ReadAllQuery(name="Employee.findAll" referenceClass=Employee sql="SELECT "id", "address", "attachments", "business_phone", "city", "company", "country_region", "email_address", "fax_number", "first_name", "home_phone", "job_title", "last_name", "mobile_phone", "notes", "state_province", "web_page", "zip_postal_code" FROM "employees"")
    Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException
    Internal Exception: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "employees" non trouvée
    Table "employees" not found; SQL statement:
    SELECT "id", "address", "attachments", "business_phone", "city", "company", "country_region", "email_address", "fax_number", "first_name", "home_phone", "job_title", "last_name", "mobile_phone", "notes", "state_province", "web_page", "zip_postal_code" FROM "employees" [42102-199]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:451)
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:427)
    at org.h2.message.DbException.get(DbException.java:205)
    at org.h2.message.DbException.get(DbException.java:181)
    at org.h2.command.Parser.readTableOrView(Parser.java:7146)
    at org.h2.command.Parser.readTableFilter(Parser.java:1895)
    at org.h2.command.Parser.parseSelectSimpleFromPart(Parser.java:2641)
    at org.h2.command.Parser.parseSelectSimple(Parser.java:2788)
    at org.h2.command.Parser.parseSelectSub(Parser.java:2636)
    at org.h2.command.Parser.parseSelectUnion(Parser.java:2469)
    at org.h2.command.Parser.parseSelect(Parser.java:2440)
    at org.h2.command.Parser.parsePrepared(Parser.java:814)
    at org.h2.command.Parser.parse(Parser.java:788)
    at org.h2.command.Parser.parse(Parser.java:760)
    at org.h2.command.Parser.prepareCommand(Parser.java:683)
    at org.h2.engine.Session.prepareLocal(Session.java:627)
    at org.h2.server.TcpServerThread.process(TcpServerThread.java:270)
    at org.h2.server.TcpServerThread.run(TcpServerThread.java:175)
    at java.lang.Thread.run(Thread.java:748)

    Une image du shema de mes tables dans le dataSource explorer
    Nom : shemaDB.png
Affichages : 425
Taille : 70,1 Ko

    Et la connexion à la base reussie parfaitement. Je vous remercie d'avance pour vos coups de main car j'en ai vivement besoin.

  2. #2
    Membre du Club
    Homme Profil pro
    Etudiant
    Inscrit en
    Avril 2016
    Messages
    60
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : Etudiant
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Avril 2016
    Messages : 60
    Points : 58
    Points
    58
    Par défaut
    De tatonnement en tatonnement j'ai fini par trouvé la solution . Je la mets ici au cas où.
    Le problème était que mon nom de table à laquelle fait reference l'entité doit contenir le shema comme ceci

    @Table(name="MON_SCHEMA.\"ma_table\"")
    au lieu de @Table(name="\"ma_table\"")

  3. #3
    Membre du Club
    Homme Profil pro
    Etudiant
    Inscrit en
    Avril 2016
    Messages
    60
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Vienne (Limousin)

    Informations professionnelles :
    Activité : Etudiant
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Avril 2016
    Messages : 60
    Points : 58
    Points
    58
    Par défaut
    Bonjour, mon problème de shema est resolu mais derrière un atre apprarait. J'arrive pas à faire un select JPQL sur les entités contenant des champs foreogn keys

    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
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    package model;
     
    import java.io.Serializable;
    import javax.persistence.*;
    import java.util.List;
     
     
    /**
     * The persistent class for the "customers" database table.
     * 
     */
    @Entity
    @Table(name="NORTHWIND.\"customers\"")
    @NamedQuery(name="Customer.findAll", query="SELECT c FROM Customer c")
    public class Customer implements Serializable {
    	private static final long serialVersionUID = 1L;
     
    	@Id
    	@GeneratedValue(strategy=GenerationType.TABLE)
    	@Column(name="\"id\"")
    	private int id;
     
    	@Column(name="\"address\"")
    	private String address;
     
    	@Lob
    	@Column(name="\"attachments\"")
    	private byte[] attachments;
     
    	@Column(name="\"business_phone\"")
    	private String businessPhone;
     
    	@Column(name="\"city\"")
    	private String city;
     
    	@Column(name="\"company\"")
    	private String company;
     
    	@Column(name="\"country_region\"")
    	private String countryRegion;
     
    	@Column(name="\"email_address\"")
    	private String emailAddress;
     
    	@Column(name="\"fax_number\"")
    	private String faxNumber;
     
    	@Column(name="\"first_name\"")
    	private String firstName;
     
    	@Column(name="\"home_phone\"")
    	private String homePhone;
     
    	@Column(name="\"job_title\"")
    	private String jobTitle;
     
    	@Column(name="\"last_name\"")
    	private String lastName;
     
    	@Column(name="\"mobile_phone\"")
    	private String mobilePhone;
     
    	@Column(name="\"notes\"")
    	private String notes;
     
    	@Column(name="\"state_province\"")
    	private String stateProvince;
     
    	@Column(name="\"web_page\"")
    	private String webPage;
     
    	@Column(name="\"zip_postal_code\"")
    	private String zipPostalCode;
     
    	//bi-directional many-to-one association to Order
    	@OneToMany(mappedBy="customer")
    	private List<Order> orders;
     
    	public Customer() {
    	}
     
    	public int getId() {
    		return this.id;
    	}
     
    	public void setId(int id) {
    		this.id = id;
    	}
     
    	public String getAddress() {
    		return this.address;
    	}
     
    	public void setAddress(String address) {
    		this.address = address;
    	}
     
    	public byte[] getAttachments() {
    		return this.attachments;
    	}
     
    	public void setAttachments(byte[] attachments) {
    		this.attachments = attachments;
    	}
     
    	public String getBusinessPhone() {
    		return this.businessPhone;
    	}
     
    	public void setBusinessPhone(String businessPhone) {
    		this.businessPhone = businessPhone;
    	}
     
    	public String getCity() {
    		return this.city;
    	}
     
    	public void setCity(String city) {
    		this.city = city;
    	}
     
    	public String getCompany() {
    		return this.company;
    	}
     
    	public void setCompany(String company) {
    		this.company = company;
    	}
     
    	public String getCountryRegion() {
    		return this.countryRegion;
    	}
     
    	public void setCountryRegion(String countryRegion) {
    		this.countryRegion = countryRegion;
    	}
     
    	public String getEmailAddress() {
    		return this.emailAddress;
    	}
     
    	public void setEmailAddress(String emailAddress) {
    		this.emailAddress = emailAddress;
    	}
     
    	public String getFaxNumber() {
    		return this.faxNumber;
    	}
     
    	public void setFaxNumber(String faxNumber) {
    		this.faxNumber = faxNumber;
    	}
     
    	public String getFirstName() {
    		return this.firstName;
    	}
     
    	public void setFirstName(String firstName) {
    		this.firstName = firstName;
    	}
     
    	public String getHomePhone() {
    		return this.homePhone;
    	}
     
    	public void setHomePhone(String homePhone) {
    		this.homePhone = homePhone;
    	}
     
    	public String getJobTitle() {
    		return this.jobTitle;
    	}
     
    	public void setJobTitle(String jobTitle) {
    		this.jobTitle = jobTitle;
    	}
     
    	public String getLastName() {
    		return this.lastName;
    	}
     
    	public void setLastName(String lastName) {
    		this.lastName = lastName;
    	}
     
    	public String getMobilePhone() {
    		return this.mobilePhone;
    	}
     
    	public void setMobilePhone(String mobilePhone) {
    		this.mobilePhone = mobilePhone;
    	}
     
    	public String getNotes() {
    		return this.notes;
    	}
     
    	public void setNotes(String notes) {
    		this.notes = notes;
    	}
     
    	public String getStateProvince() {
    		return this.stateProvince;
    	}
     
    	public void setStateProvince(String stateProvince) {
    		this.stateProvince = stateProvince;
    	}
     
    	public String getWebPage() {
    		return this.webPage;
    	}
     
    	public void setWebPage(String webPage) {
    		this.webPage = webPage;
    	}
     
    	public String getZipPostalCode() {
    		return this.zipPostalCode;
    	}
     
    	public void setZipPostalCode(String zipPostalCode) {
    		this.zipPostalCode = zipPostalCode;
    	}
     
    	public List<Order> getOrders() {
    		return this.orders;
    	}
     
    	public void setOrders(List<Order> orders) {
    		this.orders = orders;
    	}
     
    	public Order addOrder(Order order) {
    		getOrders().add(order);
    		order.setCustomer(this);
     
    		return order;
    	}
     
    	public Order removeOrder(Order order) {
    		getOrders().remove(order);
    		order.setCustomer(null);
     
    		return order;
    	}
     
    }
    Mon entité order contient l'id customer donc j'arrive pas à faire un select JPQL sur Order j'ai l'erreur Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Colonne "CUSTOMER_ID" non trouvée
    Column "CUSTOMER_ID" not found; SQL statement: (je comprends bien qu'il trouve pas l'id customer mais je sais pas c'est quoi les bonnes annotations)
    le code de l'entié order:

    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
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    package model;
     
    import java.io.Serializable;
    import javax.persistence.*;
    import java.math.BigDecimal;
    import java.sql.Timestamp;
    import java.util.List;
     
     
    /**
     * The persistent class for the "orders" database table.
     * 
     */
    @Entity
    @Table(name="NORTHWIND.\"orders\"")
    @NamedQuery(name="Order.findAll", query="SELECT o FROM Order o")
    public class Order implements Serializable {
    	private static final long serialVersionUID = 1L;
     
    	@Id
    	@GeneratedValue(strategy=GenerationType.TABLE)
    	@Column(name="\"id\"")
    	private int id;
     
    	@Column(name="\"customer_id\"")
    	private int customerId;
     
    	@Column(name="\"employee_id\"")
    	private int employeeId;
     
    	@Column(name="\"notes\"")
    	private String notes;
     
    	@Column(name="\"order_date\"")
    	private Timestamp orderDate;
     
    	@Column(name="\"paid_date\"")
    	private Timestamp paidDate;
     
    	@Column(name="\"payment_type\"")
    	private String paymentType;
     
    	@Column(name="\"ship_address\"")
    	private String shipAddress;
     
    	@Column(name="\"ship_city\"")
    	private String shipCity;
     
    	@Column(name="\"ship_country_region\"")
    	private String shipCountryRegion;
     
    	@Column(name="\"ship_name\"")
    	private String shipName;
     
    	@Column(name="\"ship_state_province\"")
    	private String shipStateProvince;
     
    	@Column(name="\"ship_zip_postal_code\"")
    	private String shipZipPostalCode;
     
    	@Column(name="\"shipped_date\"")
    	private Timestamp shippedDate;
     
    	@Column(name="\"shipper_id\"")
    	private int shipperId;
     
    	@Column(name="\"shipping_fee\"")
    	private BigDecimal shippingFee;
     
    	@Column(name="\"status_id\"")
    	private int statusId;
     
    	@Column(name="\"tax_rate\"")
    	private double taxRate;
     
    	@Column(name="\"tax_status_id\"")
    	private int taxStatusId;
     
    	@Column(name="\"taxes\"")
    	private BigDecimal taxes;
     
    	//bi-directional many-to-one association to InventoryTransaction
    	@OneToMany(mappedBy="order")
    	private List<InventoryTransaction> inventoryTransactions;
     
    	//bi-directional many-to-one association to Invoice
    	@OneToMany(mappedBy="order")
    	private List<Invoice> invoices;
     
    	//bi-directional many-to-one association to OrderDetail
    	@OneToMany(mappedBy="order")
    	private List<OrderDetail> orderDetails;
     
    	//bi-directional many-to-one association to Customer
    	@ManyToOne
    	@JoinColumns({
    		})
    	private Customer customer;
     
    	//bi-directional many-to-one association to Employee
    	@ManyToOne
    	@JoinColumns({
    		})
    	private Employee employee;
     
    	//bi-directional many-to-one association to OrdersStatus
    	@ManyToOne
    	@JoinColumns({
    		})
    	private OrdersStatus ordersStatus;
     
    	//bi-directional many-to-one association to OrdersTaxStatus
    	@ManyToOne
    	@JoinColumns({
    		})
    	private OrdersTaxStatus ordersTaxStatus;
     
    	//bi-directional many-to-one association to Shipper
    	@ManyToOne
    	@JoinColumns({
    		})
    	private Shipper shipper;
     
    	public Order() {
    	}
     
    	public int getId() {
    		return this.id;
    	}
     
    	public void setId(int id) {
    		this.id = id;
    	}
     
    	public int getCustomerId() {
    		return this.customerId;
    	}
     
    	public void setCustomerId(int customerId) {
    		this.customerId = customerId;
    	}
     
    	public int getEmployeeId() {
    		return this.employeeId;
    	}
     
    	public void setEmployeeId(int employeeId) {
    		this.employeeId = employeeId;
    	}
     
    	public String getNotes() {
    		return this.notes;
    	}
     
    	public void setNotes(String notes) {
    		this.notes = notes;
    	}
     
    	public Timestamp getOrderDate() {
    		return this.orderDate;
    	}
     
    	public void setOrderDate(Timestamp orderDate) {
    		this.orderDate = orderDate;
    	}
     
    	public Timestamp getPaidDate() {
    		return this.paidDate;
    	}
     
    	public void setPaidDate(Timestamp paidDate) {
    		this.paidDate = paidDate;
    	}
     
    	public String getPaymentType() {
    		return this.paymentType;
    	}
     
    	public void setPaymentType(String paymentType) {
    		this.paymentType = paymentType;
    	}
     
    	public String getShipAddress() {
    		return this.shipAddress;
    	}
     
    	public void setShipAddress(String shipAddress) {
    		this.shipAddress = shipAddress;
    	}
     
    	public String getShipCity() {
    		return this.shipCity;
    	}
     
    	public void setShipCity(String shipCity) {
    		this.shipCity = shipCity;
    	}
     
    	public String getShipCountryRegion() {
    		return this.shipCountryRegion;
    	}
     
    	public void setShipCountryRegion(String shipCountryRegion) {
    		this.shipCountryRegion = shipCountryRegion;
    	}
     
    	public String getShipName() {
    		return this.shipName;
    	}
     
    	public void setShipName(String shipName) {
    		this.shipName = shipName;
    	}
     
    	public String getShipStateProvince() {
    		return this.shipStateProvince;
    	}
     
    	public void setShipStateProvince(String shipStateProvince) {
    		this.shipStateProvince = shipStateProvince;
    	}
     
    	public String getShipZipPostalCode() {
    		return this.shipZipPostalCode;
    	}
     
    	public void setShipZipPostalCode(String shipZipPostalCode) {
    		this.shipZipPostalCode = shipZipPostalCode;
    	}
     
    	public Timestamp getShippedDate() {
    		return this.shippedDate;
    	}
     
    	public void setShippedDate(Timestamp shippedDate) {
    		this.shippedDate = shippedDate;
    	}
     
    	public int getShipperId() {
    		return this.shipperId;
    	}
     
    	public void setShipperId(int shipperId) {
    		this.shipperId = shipperId;
    	}
     
    	public BigDecimal getShippingFee() {
    		return this.shippingFee;
    	}
     
    	public void setShippingFee(BigDecimal shippingFee) {
    		this.shippingFee = shippingFee;
    	}
     
    	public int getStatusId() {
    		return this.statusId;
    	}
     
    	public void setStatusId(int statusId) {
    		this.statusId = statusId;
    	}
     
    	public double getTaxRate() {
    		return this.taxRate;
    	}
     
    	public void setTaxRate(double taxRate) {
    		this.taxRate = taxRate;
    	}
     
    	public int getTaxStatusId() {
    		return this.taxStatusId;
    	}
     
    	public void setTaxStatusId(int taxStatusId) {
    		this.taxStatusId = taxStatusId;
    	}
     
    	public BigDecimal getTaxes() {
    		return this.taxes;
    	}
     
    	public void setTaxes(BigDecimal taxes) {
    		this.taxes = taxes;
    	}
     
    	public List<InventoryTransaction> getInventoryTransactions() {
    		return this.inventoryTransactions;
    	}
     
    	public void setInventoryTransactions(List<InventoryTransaction> inventoryTransactions) {
    		this.inventoryTransactions = inventoryTransactions;
    	}
     
    	public InventoryTransaction addInventoryTransaction(InventoryTransaction inventoryTransaction) {
    		getInventoryTransactions().add(inventoryTransaction);
    		inventoryTransaction.setOrder(this);
     
    		return inventoryTransaction;
    	}
     
    	public InventoryTransaction removeInventoryTransaction(InventoryTransaction inventoryTransaction) {
    		getInventoryTransactions().remove(inventoryTransaction);
    		inventoryTransaction.setOrder(null);
     
    		return inventoryTransaction;
    	}
     
    	public List<Invoice> getInvoices() {
    		return this.invoices;
    	}
     
    	public void setInvoices(List<Invoice> invoices) {
    		this.invoices = invoices;
    	}
     
    	public Invoice addInvoice(Invoice invoice) {
    		getInvoices().add(invoice);
    		invoice.setOrder(this);
     
    		return invoice;
    	}
     
    	public Invoice removeInvoice(Invoice invoice) {
    		getInvoices().remove(invoice);
    		invoice.setOrder(null);
     
    		return invoice;
    	}
     
    	public List<OrderDetail> getOrderDetails() {
    		return this.orderDetails;
    	}
     
    	public void setOrderDetails(List<OrderDetail> orderDetails) {
    		this.orderDetails = orderDetails;
    	}
     
    	public OrderDetail addOrderDetail(OrderDetail orderDetail) {
    		getOrderDetails().add(orderDetail);
    		orderDetail.setOrder(this);
     
    		return orderDetail;
    	}
     
    	public OrderDetail removeOrderDetail(OrderDetail orderDetail) {
    		getOrderDetails().remove(orderDetail);
    		orderDetail.setOrder(null);
     
    		return orderDetail;
    	}
     
    	public Customer getCustomer() {
    		return this.customer;
    	}
     
    	public void setCustomer(Customer customer) {
    		this.customer = customer;
    	}
     
    	public Employee getEmployee() {
    		return this.employee;
    	}
     
    	public void setEmployee(Employee employee) {
    		this.employee = employee;
    	}
     
    	public OrdersStatus getOrdersStatus() {
    		return this.ordersStatus;
    	}
     
    	public void setOrdersStatus(OrdersStatus ordersStatus) {
    		this.ordersStatus = ordersStatus;
    	}
     
    	public OrdersTaxStatus getOrdersTaxStatus() {
    		return this.ordersTaxStatus;
    	}
     
    	public void setOrdersTaxStatus(OrdersTaxStatus ordersTaxStatus) {
    		this.ordersTaxStatus = ordersTaxStatus;
    	}
     
    	public Shipper getShipper() {
    		return this.shipper;
    	}
     
    	public void setShipper(Shipper shipper) {
    		this.shipper = shipper;
    	}
     
    }
    Vous aides seront très précieuse, car je galère. Je vous remercie d'avance.

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

Discussions similaires

  1. accés aux données externes avec sharepoint
    Par djidjima dans le forum Configuration
    Réponses: 0
    Dernier message: 03/10/2009, 20h03
  2. Réponses: 2
    Dernier message: 28/01/2009, 18h05
  3. Réponses: 4
    Dernier message: 06/07/2008, 13h46
  4. [AJAX] Acces aux données avec ajax dans une fonction javascript
    Par Sidi-Bou dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 03/03/2008, 12h04
  5. Réponses: 2
    Dernier message: 22/06/2006, 11h03

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