Bonjour,
Je désire faire un héritage mais j'ai l'erreur suivante :
Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 1954 [AWT-EventQueue-0] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 207, SQLState: 42S22 1954 [AWT-EventQueue-0] ERROR org.hibernate.util.JDBCExceptionReporter - Invalid column name 'DTYPE'.
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 package dataObjectLayer; import java.util.List; import java.util.Set; import javax.persistence.*; @Entity @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @Table(name="client") public class Client { @Id String email; public String getEmail() { return this.email; } public void setEmail(String email) { this.email = email; } String clientName; public String getClientName() { return this.clientName; } public void setClientName(String clientName) {this.clientName = clientName; } String password; public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } @OneToMany(cascade=CascadeType.ALL ,mappedBy="client") List<Alert> alert; public void setPeople(List<Alert> alert) {this.alert = alert;} public List<Alert> getAlert() {return this.alert;} }Et la table SQL correspondante :
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 package dataObjectLayer; import javax.persistence.Entity; import javax.persistence.Table; @Entity public class ClientPrenium extends Client { String mobileNumber; public String getMobileNumber() { return this.mobileNumber; } public void setMobileNumber(String mobileNumber) {this.mobileNumber = mobileNumber; } String creditCardNumber; public String getCreditCardNumber() { return this.creditCardNumber; } public void setCreditCardNumber(String creditCardNumber) { this.creditCardNumber = creditCardNumber; } }
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 CREATE TABLE client( email VARCHAR(128) NOT NULL, clientName VARCHAR(255) NOT NULL, mobileNumber VARCHAR(128), creditCardNumber VARCHAR(128), password VARCHAR(128) NOT NULL, DTYPE VARCHAR(31), CONSTRAINT PK_Email PRIMARY KEY(email), );
Merci de votre aide,
S
Partager