ColdFusion 9.0 Resources |
One-to-many relationshipConsider a one-to-many relationship where one employee
belongs to many departments. You can use code like the following
to define a one-to-many mapping between the Department and Employee
objects.
public class Employee { [Id] var id:uint; [OneToMany(targetEntity="Department",mappedBy="department", fetchType="EAGER|LAZY(default)")] var depts:ArrayCollection; } There is no column specified in the Employee table but refers to the field in the Department entity that points to the Employee entity. The default fetchType value is LAZY. See Lazy loading and fetch type for information on fetch types |