Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 635

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Flex and AIR Integration in ColdFusion
The
tag specifies the foreign key column and all the attributes of the column tag. Do not specify
[JoinColumn]
for both the entities in the relationship. For example, in the one-to-one relationship between the
[JoinColumn]
Department and Employee objects, specify
the relationship.
specifies the primary key column that it refers to.
referencedColumnName
in this example.
Department
The default
value is
fetchType
One-to-many relationship
Consider 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
value is
fetchType
Many-to-one relationship
Consider a many-to-one relationship where many employees belong to a single department. You can use code like the
following to define a many-to-one mapping between the Department and Employee objects.
public class Employee
{
[Id]
var id:uint;
[ManyToOne(targetEntity="Department",fetchType="EAGER(default)|LAZY")]
[JoinColumn(name="deptId",referencedColumnName="DEPT_ID")]
var dept:Department;
}
The default
value is
fetchType
Many-to-many relationship
Consider a many-to-many relationship where many employees belong to many departments. You can use code like
the following to define a many-to-many mapping between the Department and Employee objects.
only for one of the entities depending on the direction of
[JoinColumn]
. See
"Lazy loading and fetch
EAGER
. See
"Lazy loading and fetch
LAZY
. See
"Lazy loading and fetch
EAGER
Last updated 1/20/2012
indicates the target entity, which is
Class
type" on page 631 for information on fetch types.
type" on page 631 for information on fetch types
type" on page 631 for information on fetch types
630

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents