Hibernate Join Column only finds field with OneToMany, I need OneToOne

Multi tool use
Hibernate Join Column only finds field with OneToMany, I need OneToOne
I have a strange issue in that I can map a field on a oneToMany, but the field can't be found in a OneToOne, i.e.
This works
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "task_id")
public List<Voice> voices = new ArrayList<Voice>();
But this
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "task_id")
private Voice voice;
Gives me the error:
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)
Any clues on how I can map OneToOne via a Join Column?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Why in second code snippet you are using annotation @OneToMany??
– Garima Gupta
Jul 2 at 5:53