我有一个奇怪的问题,我可以在oneToMany上映射一个字段,但是在OneToOne中找不到该字段,即
这有效
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "task_id")
public List<Voice> voices = new ArrayList<Voice>();
但是这个
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "task_id")
private Voice voice;
给我错误:
Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'gametasks0_.task_id' in 'field list'
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:686)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:663)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException (SQLError.java:653)
关于如何通过联接列映射OneToOne的任何线索吗?