ORM Datasource
Hi,
I'm taking my first shot at working with ORM in ColdFusion. I have set up the Apache Derby Embedded Orange Whip Studios database as datasource ows in ColdFusion Administrator. I have also replicated the database in SQL Server 2008 and defined it as owssqlserver in ColdFusion Administrator.
My Application.cfc is defined as follows:
<cfcomponent>
<cfset this.name = "ows38_app2">
<cfset this.datasource = "owssqlserver">
<cfset this.ormsettings = {datasource="owssqlserver"}>
<cfset this.ormenabled = "true">
</cfcomponent>
I have a Director.cfc defined as follows:
<cfcomponent persistent="true" table="Directors" datasource="owssqlserver">
<cfproperty name="DirectorID" fieldtype="id" generator="native">
<cfproperty name="FirstName" ormtype="string">
<cfproperty name="LastName" ormtype="string>
</cfcomponent>
I have a cfm file that I'm running with the following code:
<cfset d = entityNew("Director")>
<cfdump var = "#d#" label="New Director">
<cfset d.setFirstName("Bob")>
<cfset d.setLastName("Smith")>
<cfdump var="#d#" label="Modified Director">
<cfset entitySave(d)>
<cfdump var="#d#" label="Director entity after it was saved.">
The cfm does indeed save the entity to the table when it executes entitySave(d). However, it saves it in the Directors table in the ows Apache Derby Embedded datasource and not in the owssqlserver SQL Server 2008 datasource.
Is there just something totally obvious that I'm overlooking here?