Table per subclass inheritance relationship: How to query against the Parent class without loading a
- by Arthur Ronald F D Garcia
Suppose a Table per subclass inheritance relationship which can be described bellow (From wikibooks.org - see here)
Notice Parent class is not abstract
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
public class Project {
@Id
private long id;
// Other properties
}
@Entity
@Table(name="LARGEPROJECT")
public class LargeProject extends Project {
private BigDecimal budget;
}
@Entity
@Table(name="SMALLPROJECT")
public class SmallProject extends Project {
}
I have a scenario where i just need to retrieve the Parent class. Because of performance issues, What should i do to run a HQL query in order to retrieve the Parent class and just the Parent class without loading any subclass ???