Mapping Ausnahme in Hibernate mit CollectionOfElements
-
09-10-2019 - |
Frage
Ich versuche, diese Zuordnung zur Arbeit zu kommen, aber ich habe diese seltsame Ausnahmemeldung
Could not determine type for: foo.ProcessUser, at table: ProcessUser_onetimeCodes, for columns: [org.hibernate.mapping.Column(processUser)]
@Entity
public class ProcessUser {
@Setter
private List<OnetimeCodes> onetimeCodes;
@CollectionOfElements
public List<OnetimeCodes> getOnetimeCodes() {
return onetimeCodes;
}
}
@Embeddable
@Data
public class OnetimeCodes {
@Parent
private ProcessUser processUser;
@Column(nullable=false)
@NotEmpty
private String password;
public OnetimeCodes(ProcessUser processUser, String password) {
this.processUser = processUser;
this.password = password;
}
}
Stelle Kann jemand was hier falsch?
Ich habe hibernate.hbm2ddl.auto
auf create
Lösung
fand ich den Fehler.
Sie können keine Zuordnung auf dem Attribut in einer der Klassen, und auf Getter auf der anderen Seite. Sie sollten übereinstimmen.
Also habe ich geändert
@Embeddable
@Data
public class OnetimeCodes {
@Parent
private ProcessUser processUser;
@Column(nullable=false)
@NotEmpty
private String password;
public OnetimeCodes(ProcessUser processUser, String password) {
this.processUser = processUser;
this.password = password;
}
}
@Embeddable
public class OnetimeCodes {
private ProcessUser processUser;
private String password;
public OnetimeCodes(ProcessUser processUser, String password) {
this.processUser = processUser;
this.password = password;
}
@Parent
public ProcessUser getProcessUser() {
return processUser;
}
public void setProcessUser(ProcessUser processUser) {
this.processUser = processUser;
}
@Column(nullable=false)
@NotEmpty
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
und Viola. Sehr dumm, wenn Sie mich fragen.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow