I have the following Entity classes
Patients
@Entity
@Table(name = "pacientes", schema = "sau")
public class Pacientes implements Serializable {
private static final long serialVersionUID = 5776384003601026304L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
@Column(name = "idPaciente")
private Long idPaciente;
@JoinColumn(name="idPessoa")
@ManyToOne(cascade = CascadeType.ALL)
private Pessoas pessoa;
@Column(name = "nomeResponsavel")
private String nomeResponsavel;
@Column(name = "cpfResponsavel")
private String cpfResponsavel;
public Pacientes() {
}
//gets and sets
}
people
@Entity
@Table(name = "pessoas", schema="glb")
public class Pessoas implements Serializable {
private static final long serialVersionUID = -4042023941980758267L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Long idPessoa;
@Temporal(TemporalType.DATE)
private Date dataNascimento;
private String inscricaoEstadual;
private String inscricaoMunicipal;
private String nome;
public Pessoas() {
}
//gets and sets
}
People addresses
@Entity
@Table(name = "pessoas_enderecos" ,schema="glb")
public class PessoasEnderecos implements Serializable {
private static final long serialVersionUID = -2560542418318988673L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idPessoaEndereco;
private String bloco;
private String cep;
private String numero;
@JoinColumn(name="idPessoa")
@ManyToOne(optional = false, cascade = CascadeType.ALL)
private Pessoas pessoa;
public PessoasEnderecos() {
}
//gets and sets
}
I'm doing a patient registry where I have the following fields:
Name: Date of birth: State registration: Responsible Name: Responsible CPF: Zip code: Block: Number:
However, when saving, I can not write data from class PessoasEnderecos
other data are recording normal.
I'm getting all the data on the screen so much that I debugged the browser to see ..
Shows no error. Does anyone know what I'm missing ??
I have the following methods
Class controller
@RequestMapping(method = RequestMethod.POST, value = "/pacientes")
public Pacientes cadastrarPacientes(@RequestBody Pacientes pac) {
return pacientesService.cadastrar(pac);
}
class service
public Pacientes cadastrar(Pacientes pacientes){
return pacRepository.save(pacientes);
}
class repository
public interface PacientesRepository extends JpaRepository<Pacientes, Integer> {
}