私は休止状態、restEasyおよびmySqlを使用するアプリケーションを開発しています。コンソールでこのエラーが発生する理由「フィールドリスト」の「不明な列 'worklogent0_.workerEntity」?
@Entity
@Table(name ="worker")
public class WorkerEntity extends Worker implements Serializable {
public WorkerEntity(String worker_name, String worker_surname, int worker_salary, String worker_task) {
super(worker_name, worker_surname, worker_salary, worker_task);
// TODO Auto-generated constructor stub
}
private static final long serialVersionUID = 5364531535728847001L;
@OneToOne(mappedBy="workerEntity")
private WorklogEntity workLogEntity;
public WorkerEntity(){
super();
}
public WorklogEntity getWorkLogEntity() {
return workLogEntity;
}
public void setWorkLogEntity(WorklogEntity workLogEntity) {
this.workLogEntity = workLogEntity;
}
@Override
public int getWorker_salary() {
// TODO Auto-generated method stub
return super.getWorker_salary();
}
@Override
public void setWorker_salary(int worker_salary) {
// TODO Auto-generated method stub
super.setWorker_salary(worker_salary);
}
@Override
public String getWorker_task() {
// TODO Auto-generated method stub
return super.getWorker_task();
}
@Override
public void setWorker_task(String worker_task) {
// TODO Auto-generated method stub
super.setWorker_task(worker_task);
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Override
public int getWorker_id() {
// TODO Auto-generated method stub
return super.getWorker_id();
}
@Override
public void setWorker_id(int worker_id) {
// TODO Auto-generated method stub
super.setWorker_id(worker_id);
}
@Override
public String getWorker_name() {
// TODO Auto-generated method stub
return super.getWorker_name();
}
@Override
public void setWorker_name(String worker_name) {
// TODO Auto-generated method stub
super.setWorker_name(worker_name);
}
@Override
public String getWorker_surname() {
// TODO Auto-generated method stub
return super.getWorker_surname();
}
@Override
public void setWorker_surname(String worker_surname) {
// TODO Auto-generated method stub
super.setWorker_surname(worker_surname);
}
@Override
public int hashCode() {
// TODO Auto-generated method stub
return super.hashCode();
}
@Override
public boolean equals(Object obj) {
// TODO Auto-generated method stub
return super.equals(obj);
}
@Override
protected Object clone() throws CloneNotSupportedException {
// TODO Auto-generated method stub
return super.clone();
}
@Override
public String toString() {
// TODO Auto-generated method stub
return super.toString();
}
@Override
protected void finalize() throws Throwable {
// TODO Auto-generated method stub
super.finalize();
}
}
そして、これは私のworklogEntityクラスです::これは私のworkerEntityクラスです 労働者と作業ログ:。私はMySQLで2つのテーブルを持っている
Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'worklogent0_.workerEntity' in 'field list'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:536)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115)
at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1983)
at com.mysql.cj.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1826)
at com.mysql.cj.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1923)
at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.executeQuery(CachedPreparedStatement.java:113)
at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:504)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
... 199 more
:私のアプリは、私はこのエラーを得た
@Entity
@Table(name ="worklog")
public class WorklogEntity extends Worklog implements Serializable {
private static final long serialVersionUID = 5364531535728847001L;
@OneToOne
@JoinColumn(name="worker_id")
private WorkerEntity workerEntity;
public WorkerEntity getWorkerEntity() {
return workerEntity;
}
public void setWorkerEntity(WorkerEntity workerEntity) {
this.workerEntity = workerEntity;
}
public WorklogEntity() {
super();
}
public WorklogEntity(Long id, Integer minutes, Date date, String task, String description) {
super(id, minutes, date, task, description);
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Override
public Long getId() {
return super.getId();
}
@Temporal(TemporalType.DATE)
@Override
public Date getDate() {
return super.getDate();
}
@Override
public Integer getMinutes() {
return super.getMinutes();
}
@Override
public String getTask() {
return super.getTask();
}
@Override
public String getDescription() {
return super.getDescription();
}
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(getId()).append(" ").append(getDate()).append(" ")
.append(getMinutes()).append(" ").append(getTask()).append(" ")
.append(getDescription()).append(" ");
return stringBuilder.toString();
}
}
これはWorker.javaクラス鉱山である:私は間違えてい
public class Worklog {
private Long id;
private Integer minutes;
private Date date;
private String task;
private String description;
public Worklog() {
}
public Worklog(Long id, Integer minutes, Date date, String task, String description) {
super();
this.id = id;
this.minutes = minutes;
this.date = date;
this.task = task;
this.description = description;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Integer getMinutes() {
return minutes;
}
public void setMinutes(Integer minutes) {
this.minutes = minutes;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getTask() {
return task;
}
public void setTask(String task) {
this.task = task;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
:
public class Worker {
private int worker_id;
private String worker_name;
private String worker_surname;
private int worker_salary;
private String worker_task;
public Worker(String worker_name, String worker_surname, int worker_salary, String worker_task) {
super();
this.worker_name = worker_name;
this.worker_surname = worker_surname;
this.worker_salary = worker_salary;
this.worker_task = worker_task;
}
public Worker() {
// TODO Auto-generated constructor stub
}
public int getWorker_salary() {
return worker_salary;
}
public void setWorker_salary(int worker_salary) {
this.worker_salary = worker_salary;
}
public String getWorker_task() {
return worker_task;
}
public void setWorker_task(String worker_task) {
this.worker_task = worker_task;
}
public int getWorker_id() {
return worker_id;
}
public void setWorker_id(int worker_id) {
this.worker_id = worker_id;
}
public String getWorker_name() {
return worker_name;
}
public void setWorker_name(String worker_name) {
this.worker_name = worker_name;
}
public String getWorker_surname() {
return worker_surname;
}
public void setWorker_surname(String worker_surname) {
this.worker_surname = worker_surname;
}
}
これは、鉱山作業ログクラスですか?
拡張しているクラスには何がありますか?あなたは正しいJoinColumnアノテーションをインポートしていますか? – Giovanni
「正しいJoinColumnアノテーション」とはどういう意味ですか? – Atenica