I\'m trying to use inheritance with ORMLite and I can\'t work out if it is supported or not from looking at the documentation and googling.
What I want to do is have
The @DatabaseTable
annotation is only necessary on the Student
or Teacher
tables and would not be used if it was on the Person
base class.
What you need to have is a @DatabaseField
annotation on the id
and name
fields in Person
. For example:
public abstract class Person{
@DatabaseField(generatedId = true)
public int id;
@DatabaseField
public String name;
}
ORMLite should walk the class hierarchy and any fields from the base class should be included in the Student
and Teacher
tables. If you edit your question to show the @DatabaseField
or other annotations, I can comment more.