60 likes | 146 Views
Relationships. Celsina Bignoli bignolic@smccd.net. Cardinality. One-to-one(1:1) One office has one address One-to-many (1:N) A group and the people part of it Many-to-many(M:N) Student takes many classes, a class has many students. 1:1 Relationship - Example. Department. Employee.
E N D
Relationships Celsina Bignoli bignolic@smccd.net
Cardinality • One-to-one(1:1) • One office has one address • One-to-many (1:N) • A group and the people part of it • Many-to-many(M:N) • Student takes many classes, a class has many students
1:1 Relationship - Example Department Employee Foreign key
1:N Relationship Example Employee Foreign key Department
M:N Relationship Example Book Author Book_Author
Implementing Relationships Using CMP • Entity Bean has no fields • Getter/setter methods are declared abstract • ejbCreate(), ejbLoad(), ejbStore() have no code • Relationships are defined in the deployment descriptor