Oi pessoal, tudo bem? Estou fazendo um projetinho para treinar algumas coisas que aprendi e estou recebendo um erro na hora de salvar no banco de dados.
JDBC exception executing SQL [select u1_0.user_id,u1_0.full_name,u1_0.user_password,u1_0.user_name from tb_users u1_0 where u1_0.user_id=?] [Table 'easysocial.tb_users' doesn't exist] [n/a]
@Entity
@Table(name = "tb_users")
@Data
public class User implements UserDetails {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "user_id", unique = true)
private UUID id;
@Column(name = "full_name")
private String fullName;
@Column(name = "user_name", unique = true)
private String userName;
@Column(name = "user_password")
private String password;
@OneToMany(fetch = FetchType.LAZY)
@JoinColumn(referencedColumnName = "user_id")
private List<CellPhone> cellPhones;
public User(String fullName, String userName, String password, List<CellPhone> cellPhones) {
this.fullName = fullName;
this.userName = userName;
this.password = password;
this.cellPhones = cellPhones;
}
public void update(String fullName, String userName, String password, List<CellPhone> cellPhones){
if(!fullName.isBlank()){
this.fullName = fullName;
}
if(!userName.isBlank() || userName.length() < 4){
this.userName = userName;
}
if(!password.isBlank() || password.length() < 4){
this.password = password;
}
this.cellPhones = cellPhones;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return List.of(new SimpleGrantedAuthority("ROLE_USER"));
}
public String getPassword() {
return password;
}
@Override
public String getUsername() {
return this.userName;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
@Entity
@Table(name = "tb_cellphone")
@Data
public class CellPhone {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "phone_id", unique = true)
private UUID id;
@Column(name = "cell_phone")
private String cellphone;
@Column(name = "user_id")
private UUID userId;
}
Alguém pode me dar uma luz?