Bonjour,
J'ai un problème avec mon mapping bidirectionnel.
Hibernante pense que c'est un attribut de ma table sql...
Voici le code :Code:
1
2
3 Hibernate: select alert0_.id as id1_, alert0_.client as client1_, alert0_.clientId as clientId1_, alert0_.instrument as instrument1_, alert0_.instrumentCode as instrume3_1_, alert0_.isActive as isActive1_, alert0_.isHit as isHit1_, alert0_.name as name1_, alert0_.sendEmail as sendEmail1_, alert0_.sendSMS as sendSMS1_, alert0_.targetPrice as targetPr9_1_ from alert alert0_ where alert0_.instrumentCode=? 1841 [AWT-EventQueue-0] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 207, SQLState: 42S22 1841 [AWT-EventQueue-0] ERROR org.hibernate.util.JDBCExceptionReporter - Invalid column name 'instrument'.
Code:
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 package dataObjectLayer; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.Set; import javax.persistence.*; @Entity @Table(name="instrument") public class Instrument { @Id String code; public String getCode() { return this.code; } public void setCode(String code) { this.code = code; } Double lastPrice; public Double getLastPrice() { return this.lastPrice; } public void setLastPrice(Double lastPrice) { this.lastPrice = lastPrice; } Date lastUpdateTime; public Date getLastUpdateTime() {return this.lastUpdateTime; } public void setLastUpdateTime(Date lastUpdateTime) {this.lastUpdateTime = lastUpdateTime; } @OneToMany(mappedBy="instrument") List<Alert> alert; public void setAlert(List<Alert> alert) {this.alert = alert;} public List<Alert> getAlert() {return alert;} public Instrument() {} public Instrument(String code) { this.code = code; this.lastUpdateTime = new Date(); this.lastPrice = 0.0; } }
Merci de votre aide,Code:
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 package dataObjectLayer; import java.util.GregorianCalendar; import javax.persistence.*; @Entity @Table(name="alert") public class Alert { @Id @GeneratedValue private int id; public int getId() { return this.id; } private String clientId; public String getClientId() { return this.clientId; } public void setClientId(String email) { this.clientId = email; } private String instrumentCode; public String getInstrumentCode() { return this.instrumentCode; } public void setInstrumentCode(String code) { this.instrumentCode = code; } private String name; public String getName() { return this.name; } public void setName(String name) { this.name = name; } private Double targetPrice; public Double getTargetPrice() { return this.targetPrice; } public void setTargetPrice(Double price) { this.targetPrice = price; } private Boolean sendSMS; public Boolean getSendSMS() { return this.sendSMS; } public void setSendSMS(Boolean sendsms) { this.sendSMS = sendsms; } private Boolean sendEmail; public Boolean getSendEmail() { return this.sendEmail; } public void setSendEmail(Boolean email) { this.sendEmail = email; } private Boolean isActive; public Boolean getIsActive() { return this.isActive; } public void setIsActive(Boolean active) { this.isActive = active; } private Boolean isHit; public Boolean getIsHit() { return this.isHit; } public void setIsHit(Boolean isHit) { this.isHit = isHit; } @ManyToOne @JoinColumn(name="client") private Client client; public Client getClient() { return this.client; } public void setClient(Client client) { this.client = client; } @ManyToOne @JoinColumn(name="instrument") private Instrument instrument; public Instrument getInstrument() { return this.instrument; } public void setInstrument(Instrument instrument) { this.instrument = instrument; } public Alert() {} public Alert(String clientId,String instrumentCode,String name, Double targetPrice, Boolean sendSMS, Boolean sendEmail) { this.clientId = clientId; this.instrumentCode = instrumentCode; this.name = name; this.targetPrice = targetPrice; this.sendSMS = sendSMS; this.sendEmail = sendEmail; this.isActive = true; this.isHit = true; } }
S