Of course, if the properties of the parent are passed down to the child class, they should be automatically be persisted if the inheritance mapping is done correctly.
Here's a little tutorial on how to map inherited classes using Hibernate and JPA annotations. It should clear up any doubt:
http://jpa.ezhibernate.com/Javacode/learn.jsp?tutorial=16mappinginheritancewithjpa
Regardless, the key is how the classes are mapped. Here's a simple inheritance mapping example:
Code:
package com.examscam.mappings;
import javax.persistence.*;
@Entity
public class Ancestor {
private Long id;
private String nationality;
@Id
@GeneratedValue
public Long getId() {return id;}
public void setId(Long id) {this.id = id;}
public String getNationality() {return nationality;}
public void setNationality(String nationality) {
this.nationality = nationality;
}
}
Code:
package com.examscam.mappings;
import javax.persistence.*;
@Entity
public class Parentextends Ancestor{
private String lastName;
public String getLastName() {return lastName;}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
Code:
package com.examscam.mappings;
import javax.persistence.*;
@Entity
public class Child extends Parent {
private String firstName;
public String getFirstName() {return firstName;}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
}
When this code runs, you get all of the inherited properties persisted, as you can see from the database snapshot.
Code:
public static void main(String args[]) {
Ancestor a = new Ancestor();
a.setNationality("Korean");
Parent p = new Parent();
p.setNationality("Jewish"); p.setLastName("Steinberg");
Child c = new Child();
c.setNationality("Irish");
c.setLastName("McKenzie");
c.setFirstName("Cameron");
Session session = HibernateUtil.beginTransaction();
session.save(a); session.save(p); session.save(c);
HibernateUtil.commitTransaction();
}

Code:
Hibernate:
insert into Ancestor (nationality, DTYPE) values (?, 'Ancestor')
Hibernate:
insert into Ancestor (nationality, lastName, DTYPE) values (?, ?, 'Parent')
Hibernate:
insert into Ancestor (nationality, lastName, firstName, DTYPE) values (?, ?, ?, 'Child')