CHAPTER 14 Querying with (Anonymous web server) HQL and JPA QL

CHAPTER 14 Querying with HQL and JPA QL Figure 14.2 The result table of an ANSI-style inner join of two tables Second, you filter these joined rows using a join condition. (Any good database engine has much more sophisticated algorithms to evaluate a join; it usually doesn t build a memory-consuming product and then filters all rows.) The join condition is a boolean expression that evaluates to true if the joined row is to be included in the result. In case of the left outer join, each row in the (left) ITEM table that never satisfies the join condition is also included in the result, with NULL values returned for all columns of BID. A right outer join retrieves all bids and null if a bid has no item not a sensible query in this situation. Right outer joins are rarely used; developers always think from left to right and put the driving table first. In SQL, the join condition is usually specified explicitly. (Unfortunately, it isn t possible to use the name of a foreign key constraint to specify how two tables are to be joined.) You specify the join condition in the ON clause for an ANSI-style join or in the WHEREclause for a so-called theta-style join, where I.ITEM_ID=B.ITEM_ID. We now discuss the HQL and JPA QL join options. Remember that both are based on and translated into SQL, so even if the syntax is slightly different you should always refer to the two examples shown earlier and verify that you understood what the resulting SQL and resultset looks like. Figure 14.3 The result of an ANSI-style left outer join of two tables
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply