# cmp2 : EJB 2.0 Container Managed Persistence

## Examples Showing One to one Relationship

### One to One Unidirectional Relationship: Customer --> Address

### One to One Bidirectional Relationship: Customer <--> CreditCard

### One to Many Unidirectional Relationship: Customer --> Phone

Run the tests?

## Examples Showing Many/One to One/Many Relationship

### Many to One unidirectional Relationship: Cruise --> Ship

### One to Many bidirectional Relationship Cruise <--> Reservation

### Many to Many bidirectional Relationship Customer <--> Reservation

### Many to Many unidirectional Relationship Reservation --> Cabin

Run the tests?

## Examples Showing Sample EJB-QL

- SELECT OBJECT(c) FROM Ex_Customer AS c
- SELECT OBJECT(c) FROM Ex_Cruise c WHERE c.name = ?1
- SELECT OBJECT(c) FROM Ex_Customer c WHERE c.lastName = ?1 AND c.firstName = ?2
- SELECT OBJECT(c) FROM Ex_Customer c WHERE c.homeAddress.city = ?1 AND c.homeAddress.state = ?2
- SELECT OBJECT(c) FROM Ex_Customer c WHERE c.homeAddress.city = ?1 AND c.homeAddress.state = ?2
- SELECT OBJECT(c) FROM Cabin as c WHERE c.deckLevel = ?1
- SELECT OBJECT(s) FROM Ex_Ship s WHERE s.tonnage = ?1
- SELECT OBJECT(s) FROM Ex_Ship s WHERE s.tonnage BETWEEN ?1 AND ?2

Run the tests?