Working with entity-object relationships
Now we will look at relational connections via our ORM-mapped objects. We need to do this to create a new record in the ART
table. The art record has two relationships. It has an artist and a media type. We will find that working with relationships can also be simpler than writing out query relationships. It also has the advantage of being portable from one platform to the next. The field detail added in previously was done to make the ORM relations easier to follow as we read the code. It was just a little extra detail to give more meaning to the relational properties. Add the following code just above the closing <cfcomponent>
tag. We will create the two ORM relations and then go back and create the related ORM object CFCs:
<!--- Relations ---> <cfproperty name="ARTISTS" singularname="ARTIST" fieldtype="many-to-one" cfc="ARTIST" fkcolumn="ARTISTID"/> <cfproperty name="MEDIA" singularname="MEDIA" fieldtype="many-to-one"...