This mapping is used when a CFC has an embedded object
which also needs to be persisted along with the parent's data. The
CFC of the embedded object must have the attribute embedded set
to "true" on the cfcomponent tag.
Important: The embedded object
cannot be a persistent object. This feature is supported only when
the hibernate mapping is explicitly defined in the hibernate mapping
file (.hbmxml files).

Name.cfc embedded in Employee.cfc
The diagram shows two CFCs Employee and Name where EmployeeName
field of the Employee.cfc is an object of Name.cfc. In the database,
both these objects are persisted in the Employee table as a single
row. Name object itself does not have its own identity. This mapping
can be modeled as follows:
name.cfc
<cfcomponent embedded="true">
<cfproperty name="FirstName">
<cfproperty name="LastName">
<cfproperty name=" Title">
</cfcomponent>
employee.cfc
<cfcomponent persistent="true">
<cfproperty name="EmployeeID">
<cfproperty name="EmployeeName">
<cfproperty name="Designation">
</cfcomponent>
employee.hbmxml
<hibernate-mapping >
<class name="cfc:Employee" table="Employees">
<id name="EmployeeID" type="integer" column="EmployeeID">
<generator class="native"/>
</id>
<component name="EmployeeName" class="cfc:Name">
<property name="LastName" type="string" column="LastName"/>
<property name="FirstName" type="string" column="FirstName"/>
<property name="Title" type="string" column="Title"/>
</component>
<property name="Designation" type="string" column="Designation"/>
</class>
</hibernate-mapping>
If the persistent CFC has a collection of embedded objects, then
this mapping also has to be defined in the XML as shown in the following
example. Here, employee object has a collection of IMData objects.
Note that the IMData object is not persistent.
employee.cfc
<cfcomponent persistent="true">
<cfproperty name="EmployeeID">
<cfproperty name="EmployeeName">
<cfproperty name= "IMIDs" type="array">
<cfproperty name="Designation">
</cfcomponent>
IMData.cfc
<cfcomponent embedded="true">
<cfproperty name="type">
<cfproperty name="ID">
</cfcomponent>
employee.hbmxml
<hibernate-mapping>
<class name="cfc:Employee" table="Employees">
<id name="EmployeeID" type="integer" column="EmployeeID">
<generator class="native"/>
</id>
<property name="EmployeeName" type="string" column="EmployeeName"/>
<bag name="IMIDs" table="IMData" lazy="true">
<key column="EmployeeID" />
<composite-element class="cfc:IMData">
<property name="type" type="string" column="Type"/>
<property name="ID" type="string" column="ID"/>
</composite-element>
</bag>
<property name="Designation" type="string" column="Designation"/>
</class>
</hibernate-mapping>
Emp.cfm
<cfscript>
employee = EntityNew("Employee");
employee.setEmployeeName("Dan Watson");
imdata1 = new IMData();
imdata1.setType("IMClient1");
imdata1.setID("msngrId1");
imdata2 = new IMData();
imdata2.setType("IMClient 2");
imdata2.setID("msngrId2");
employee.setIMIDs([imdata1, imdata2]);
EntitySave(employee);
</cfscript>
For more details on component mapping in hibernate, see Component Mapping in Hibernate Reference
Guide.