Не удалось определить тип для: com.brainstormers.justlearnit.models.UserDetail, в таблице: пользователи, для столбцов: [org.hibernate.mapping.Column (userDetail)]
Вот мой класс User:
@Entity
@Table(name = "users")
public class User {
private String username;
private String password;
private int enabled;
@OneToOne(mappedBy = "user", cascade = CascadeType.ALL,
fetch = FetchType.LAZY, optional = false)
private UserDetail userDetail;
public User() {
}
@Id
@Column(name = "username", nullable = false, length = 50)
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Basic
@Column(name = "password", nullable = false, length = 50)
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Basic
@Column(name = "enabled", nullable = false)
public int getEnabled() {
return enabled;
}
public void setEnabled(int enabled) {
this.enabled = enabled;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return enabled == user.enabled &&
Objects.equals(username, user.username) &&
Objects.equals(password, user.password);
}
@Override
public int hashCode() {
return Objects.hash(username, password, enabled);
}
public UserDetail getUserDetail() {
return userDetail;
}
public void setUserDetail(UserDetail userDetail) {
this.userDetail = userDetail;
}
}
И класс UserDetail:
@Entity
@Table(name = "user_detail")
public class UserDetail {
private String username;
private String firstName;
private String lastName;
private String email;
private String country;
@OneToOne(fetch = FetchType.LAZY, mappedBy = "userDetail")
@JoinColumn(name = "username")
private User user;
public UserDetail() {
}
@Id
@Column(name = "username", nullable = false, length = 50)
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
@Basic
@Column(name = "first_name", nullable = false, length = 50)
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
@Basic
@Column(name = "last_name", nullable = false, length = 50)
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@Basic
@Column(name = "email", nullable = false, length = 50)
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Basic
@Column(name = "country", nullable = false, length = 50)
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UserDetail that = (UserDetail) o;
return Objects.equals(username, that.username) &&
Objects.equals(firstName, that.firstName) &&
Objects.equals(lastName, that.lastName) &&
Objects.equals(email, that.email) &&
Objects.equals(country, that.country);
}
@Override
public int hashCode() {
return Objects.hash(username, firstName, lastName, email, country);
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
Он генерируется средой постоянства в IntelliJ IDEA.Я пытался самостоятельно кодировать объекты, но получил тот же результат.