I know that you should extend Model to get all the jpa functionality. However, java does not allow multiple inheritance… Therefore, I would like to know how to architect in play the following design:
public class Person extends Model {
}
// should be able to extend Person
public class Doctor extends Model {
}
// should be able to extend Person
public class Patient extends Model {
}
public class Item extends Model {
// Doens't matter whether it's a Doctor or a Patient
@ManyToMany
public List<Person> owners;
}
Thanks in advance.
Your Doctor and Patient objects should inherit from Person. Java does not allow multiple inheritance but you can extend children objects with Person which inherits model already.
What you cannot do in Java is: