Without more details about your database structure and what you want to achieve it is very hard to make sensible suggestions. Of course you can avoid joins by not using inheritance mapped via joined subclasses. Basically if you want inheritance, that is you want an entity hierarchy, and your underlying database structure uses the table per subclass model, then you get outer joins. No way around that. Your only other option, assuming you cannot change the underlying database structure, is to model these as independent entities, that is don't use an inheritance hierarchy, and model the relationships as you would normally do with foreign keys, i.e. one-to-many, many-to-one, one-to-one, whatever is appropriate. Then by defining those relationships as lazy loading you get pretty much what you need.
The inheritance bit you could then graft on in various ways. For example define an interface HumanKind which has all the methods of Human you want to expose. Obviously Human will implement it. Provide an abstract class, lets say SuperHuman which also implements it but based on a abstract getter which provides access to a Human object. This getter will be present in all subclasses because they will have a foreign key relationship to Human. Here is a simple example (based on JPA annotations):
Code:
interface HumanKind {
Date getDateOfBirth();
}
abstract class SuperHuman implements HumanKind {
abstract Human getHuman();
Date getDateOfBirth() {
return getHuman().getDateOfBirth();
}
}
@Entity
class Parent extends SuperHuman {
private Human human = new Human();
@ManyToOne(....)
@JoinColumn(....)
Human getHuman() {
return Human;
}
void setHuman(Human human) {
this.human = human;
}
}