Hi All,

I'm still playing around with ORM and am finally trying to use it in an
actual project but am running into an issue with composite keys.

Here is a basic compnent that works.

====================
component persistent="true" table="tmp_utilities_import"
{
        property name="stateID"                 fieldtype="id"
generator="native";

        property name="stateCode"       ormtype="string"        length="2";
        property name="stateName"       ormtype="string"        length="30";
        
        property name="RECORDTIMESTAMP" ormtype="timestamp" default="";

        any function init()
        {
                variables.recordTimeStamp = now();
        }
}
====================

I have an excel doc full of records that I read in and loop over. Using the
above component, I can use the generated setters to set the values and then
use "entitySave()" to write it to the database.

The problem comes when I try to make stateCode (which is just the two letter
state abbreviation) and stateNamepart of the PK.

I change the above to:


==================
component persistent="true" table="tmp_utilities_import"
{
        property name="stateID" fieldtype="id" generator="native";
        property name="stateCode" fieldtype="id" ormtype="string"
length="2";
        property name="stateName" fieldtype="id" ormtype="string"
length="30";
        
        property name="RECORDTIMESTAMP" ormtype="timestamp" default="";

        any function init()
        {
                variables.recordTimeStamp = now();
        }
}
==================

Then I use the same code to loop over the spreadsheet. There is no error but
it does not write anything to the database either. When I run profiler (this
is SQL Server 2005 by the way), I see the inserts with the first entity but
I only see a bunch of selects with the second.

I drop the table each time I run it so I know its empty to begin with. Both
components create the table as I would expect them to (correct columns,
types and constraints).

I'm sure I'm doing something wrong obviously but I can't seem to find what
that is.

Any ideas here?

Thanks.



.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
http://cf4em.com




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349349
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to