User Guide Cancel

Define ORM mapping

The ORM mapping can be defined either in the CFC or in a separate Hibernate mapping file (.hbmxml). See Advanced mapping for details on Hibernate mapping file. The ORM mapping is defined in the CFC using ORM-specific attributes on cfcomponent and cfproperty tag. 
Following example shows a CFC (ARTIST.cfc) with mapping information:

<cfcomponent persistent="true" entityname="Artist" table="Artists">
<cfproperty name="id" column="ARTISTID" generator="increment">
<cfproperty name="firstname">
<cfproperty name="lastname">
<cfproperty name="address">
<cfproperty name="city">
<cfproperty name="state">
<cfproperty name="postalcode">
<cfproperty name="email">
<cfproperty name="phone">
<cfproperty name="fax">
<cfproperty name="thepassword">
</cfcomponent>
<cfcomponent persistent="true" entityname="Artist" table="Artists"> <cfproperty name="id" column="ARTISTID" generator="increment"> <cfproperty name="firstname"> <cfproperty name="lastname"> <cfproperty name="address"> <cfproperty name="city"> <cfproperty name="state"> <cfproperty name="postalcode"> <cfproperty name="email"> <cfproperty name="phone"> <cfproperty name="fax"> <cfproperty name="thepassword"> </cfcomponent>
<cfcomponent persistent="true" entityname="Artist" table="Artists"> 
<cfproperty name="id" column="ARTISTID" generator="increment"> 
<cfproperty name="firstname"> 
<cfproperty name="lastname"> 
<cfproperty name="address"> 
<cfproperty name="city"> 
<cfproperty name="state"> 
<cfproperty name="postalcode"> 
<cfproperty name="email"> 
<cfproperty name="phone"> 
<cfproperty name="fax"> 
<cfproperty name="thepassword"> 
</cfcomponent>

Get help faster and easier

New user?