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.
Should I put annotations and properties as if they were classes 1 to N?
If I give persist()
to the car will it save the properties of the vehicle as well?
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;
}
}