4
I know JPA
and I have other tables already implemented and working.
I would like to know how to persist the classes below, since one is an abstract class and the other is "extending" it.
I should put annotations and properties as if they were classes 1 to N?
If I give persist()
in the Car will save the Vehicle properties also?
public abstract class Veiculo {
private int idVeiculo;
public int getIdVeiculo() {
return idVeiculo;
}
public void setIdVeiculo(int idVeiculo) {
this.idVeiculo = idVeiculo;
}
}
-
public class Carro extends Veiculo {
private String marca;
public String getMarca() {
return marca;
}
public void setMarca(String marca) {
this.marca = marca;
}
}