Table per subclass inheritance relationship: How to query against the Parent class without loading a

Posted by Arthur Ronald F D Garcia on Stack Overflow See other posts from Stack Overflow or by Arthur Ronald F D Garcia
Published on 2010-04-23T17:37:00Z Indexed on 2010/04/23 19:33 UTC
Read the original article Hit count: 190

Filed under:
|
|
|
|

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 ???

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate