Tag Archives: JPA

Summary of OO hierarchy inheritance mapping strategies

1. Pre-requisites Should read first there types of mapping below: Single-table strategy Joined-tables strategy Table-per-class strategy 2. Summary mapping strategies Table 1: Summary of OO hierarchy inheritance mapping strategies (source: EJB3 in Action) References: D. Pan, R. Rahman, R. Cuprak, M. Remijan, “Mapping inheritance”, In EJB3 in Action,pp.292-293, Manning, Second Edition, 2014

Table-per-class strategy for mapping inheritance with JPA

1. Table-per-class strategy Table-per-class strategy is similar to  joined-tables strategy because each entity in domain model gets its own table. One significant difference is no relationship between the tables, which doesn’t take advantage of power of relational database at all. Following the stock market example in join-table-strategy and single-table-strategy , we are there different tables namely product, bonds, shares but product_code, description, version… Read More »

Joined-tables strategy for mapping inheritance with JPA

1. Joined-tables strategy Follow up the Single-table strategy for mapping inheritance with JPA, this strategy stores all financial products in a single table. In contrast, the joined table strategy creates separate tables for each entity in the domain model. This means that the financial product is the parent table and it holds common data for… Read More »

Single-table strategy for mapping inheritance with JPA

1. Stock Market Example Get started on our real market example with investors who want to buy or sell shares on the marketplace of which they are participants. Actually, stockbrokers (brokers) will do trading on behalf of their clients. But, there are different financial products: shares, loan, option, bond, hibrid, future, and so on. So… Read More »