|
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3) B14428-01 |
|
![]() Previous |
![]() Next |
Use a one-to-many mapping to represent the relationship between a single source object and a collection of target objects. This relationship is a good example of something that is simple to implement in Java using a Vector (or other collection types) of target objects, but difficult to implement using relational databases.
You define a one-to-many mapping at one of the property (getter or setter method) or field level of your entity.
For more information, see "Understanding One-to-Many Mapping" in the Oracle TopLink Developer's Guide.
|
Note: For an EJB 3.0 basic mapping code example, see:http://www.oracle.com/technology/tech/java/oc4j/ejb3/howtos-ejb3/howtoejb30mappingannotations/doc/how-to-ejb30-mapping-annotations.html#onetomany.
|
Example 7-18 shows how to use the @OneToMany annotation to specify a one-to-many mapping for field managedEmployees.