Database object retrieval
As in Figure 937, “Retrieving hibintro.v1.model.User
instances by HQL. ” objects being
stored by Figure 944, “Inserting payment information ” may be queried using
HQL.
Java |
|
Sql |
|
Some Remarks: Our query asks for instances of
inherit.v2.CreditCard
❶. This gets implemented as an SQL SELECT
choosing datasets whose
discriminator attribute value of dataType
❶ equals “Credit
card
”. The current result set contains just one
element ❷ in accordance
with Figure 944, “Inserting payment information ”.
Retrieving both inherit.v1.CreditCard
and inherit.v1.BankAccount
instances is
accomplished by querying for the common base class
inherit.v1.BillingDetails
:
Java |
|
Sql |
|
This is the first example of a polymorphic query yielding a heterogeneous result set❶.