
[[d-ejbql-schema]]
= EJBQL Schema

The Jakarta Enterprise Beans, EJB-QL tests perform queries against a CMP 2.0 abstract persistence
model that you deploy before you start the test runs.

Section 9.3.5, "EJB QL and SQL," in the EJB 3.1 Specification
(`http://jcp.org/en/jsr/detail?id=318`) contains a sample mapping that
shows how the Jakarta Platform, Enterprise Edition CI translates EJB QL to
SQL, which helps to clarify the EJB QL semantics.


[[d.1-persistence-schema-relationships]]
== Persistence Schema Relationships

The figure, <<figure-e-1>>, below, contains detailed
information about the persistence schema relationships.

[[figure-e-1]]
=== Figure E-1 Persistence Schema Relationships
image:img/ejbschema.png["Persistence Schema Relationships"]

Note: EJB in the figure above is a  references to Jakarta Enterprise Beans. 


[width="100%",cols="34%,33%,33%",]
|================================
a|
AliasEJB

[source,java]
----
String id;(pk)(cmp)
String alias;(cmp)
Customer customerNoop;(cmr)
Collection customersNoop;(cmr)
Collection customers;(cmr)

----

Country: DVC

[source,java]
----
String name;(cmp)
String code;(cmp)

----

AddressEJB

[source,java]
----
String id;(pk)(cmp)
String street;(cmp)
String city;(cmp)
String state;(cmp)
String zip;(cmp)
Collection phones;(cmr)

----

ProductEJB

[source,java]
----
String id;(pk)(cmp)
String name;(cmp)
float price;(cmp)
int quantity;(cmp)
long partNumber;(cmp)

----

a|
CustomerEJB

[source,java]
----
String id;(pk)(cmp)
String name;(cmp)
Country country;(cmp)
AddressLocal home;(cmr)
AddressLocal work;(cmr)
Collection creditCards;(cmr)
Collection orders;(cmr)
Collection aliases;(cmr)
SpouseLocal spouse;(cmr)

----

CreditCardEJB

[source,java]
----
String id;(pk)(cmp)
String type;(cmp)
String expires;(cmp)
boolean approved;(cmp)
String number;(cmp)
OrderLocal order;(cmr)
CustomerLocal customer;(cmr)
double balance;(cmp)

----

InfoEJB

[source,java]
----
String id;(pk)(cmp)
String street;(cmp)
String city;(cmp)
String state;(cmp)
String zip;(cmp)
SpouseLocal spouse;(cmr)
----

a|
OrderEJB

[source,java]
----
String id;(pk)(cmp)
float totalPrice;(cmp)
CustomerLocal customer;(cmr)
LineItemLocalsampleLineItem;(cmr)
Collection lineItems;(cmr)
CreditCardLocal creditCard;(cmr)

----

LineItemEJB

[source,java]
----
String id;(pk)(cmp)
int quantity;(cmp)
OrderLocal order;(cmr)
ProductLocal product;(cmr)

----

PhoneEJB

[source,java]
----
String id;(pk)(cmp)
String area:(cmp)
String number;(cmp)
AddressLocal  address;(cmr)
----

SpouseEJB

[source,java]
----
String id;(pk)(cmp)
String firstName;(cmp)
String maidenName;(cmp)
String lastName;(cmp)
String SocialSecurityNumber(cmp);
InfoLocal info;(cmr)
CustomerLocal customer;(cmr)

----

|================================



