Patent ID: 7478087

Claim:
A computer-implemented method for translating an object query into a relational database query, comprising: identifying a plurality of entities that are organized in an inheritance hierarchy that includes an entity to be queried; grouping entities in said plurality that are mapped to a common table in a relational database; building one or more query statements based on the groups; wherein identifying a plurality of entities comprises constructing a tree having nodes corresponding to ancestors and descendents of the entity to be queried; wherein grouping comprises traversing the tree, grouping nodes of the tree where entities are mapped to a common table, thus forming an entity group tree; wherein grouping nodes comprises merging parent and child nodes having entities that are mapped to a common table; wherein building one or more query statements comprises building a query statement for each entity in the entity group tree and adding the query statement to a statement list; and wherein building one or more query statements further comprises, if more than one query statement is on the statement list, joining the query statement with a relational database operator producing a union of the query statements.