Thank you very much.  That worked!

Mark, I found this article of yours, but I can't get it to work.  I am
getting the error "An association from the table musician_instrument refers
to an unmapped class:"
Here is the code for Musician.cfc
<cfcomponent hint="I am a musician" output="false" persistent="true">
    <cfproperty name="musicianID" hint="The id for the musician"
fieldtype="id" type="numeric" ormtype="integer" generator="identity">
    <cfproperty name="name" hint="name of the musician" type="string"
length="255">
    <cfproperty name="age" hint="Age of the Musician" type="numeric"
ormtype="integer">
    <cfproperty name="instruments" type="array" hint="Array of instruments"
singularname="instrument"
                fieldtype="many-to-many" cfc="model.Instrument"
linktable="musician_instrument"
                FKColumn="musicianID" inversejoincolumn="instrumentID"
                orderby="name">
</cfcomponent>

Here is the code for Instrument.cfc
<cfcomponent hint="An instrument" persistent="true" output="false">
    <cfproperty name="instrumentID" hint="id for the instrument"
fieldtype="id" ormtype="integer" generator="identity">
    <cfproperty name="name" hint="The instument name" type="string"
length="255"/>
    <cfproperty name="noise" hint="the noise it makes" type="string"
length="255" />
</cfcomponent>

In Musician.cfc, it works if I take out this line:
        <cfproperty name="instruments" type="array" hint="Array of
instruments" singularname="instrument"... >

I am on CF9.0.1 with MSSQL.  What am I doing wrong?


On Sat, Feb 5, 2011 at 3:55 AM, Mark Mandel <[email protected]> wrote:

>
> Or you could just call ApplicationStop() or better yet ORMReload().
>
> Mark
>
> Sent from my mobile device.
> On 05/02/2011 2:05 PM, "Andrew Scott" <[email protected]> wrote:
> >
> > Those errors are because you need to stop and restart the Application,
> the
> > most effective way is to change the Application name. The reason is that
> the
> > ORM is cached with the Entites, therefore a change will not take place
> until
> > the Application is restarted, hence the errors you are getting.
> >
> >
> > Regards,
> > Andrew Scott
> > http://www.andyscott.id.au/
> >
> >
> >
> >> -----Original Message-----
> >> From: Carol F [mailto:[email protected]]
> >> Sent: Saturday, 5 February 2011 1:31 PM
> >> To: cf-talk
> >> Subject: dbcreate set to "update", then errors out
> >>
> >>
> >> Hi I'm a noobie with CF and ORM. I'm using SQL Server 2008
> >>
> >> I have a test CF app, and I have the ormSettings.dbcreate set to
> "update",
> >> like so:
> >> this.ormSettings = {
> >> datasource = "dsn",
> >> dbcreate = "update",
> >> schema = "dbo",
> >> logsql = true
> >> };
> >>
> >> Here's my Account.cfc
> >> component persistent="true" {
> >> property name="id" column="AccountID" generator="identity";
> >> property name="username";
> >> property name="password";
> >> property name="datecreated";
> >> }
> >>
> >> Here's my test.cfm, in cfscript:
> >> ormReload()
> >> x = new Account();
> >> x.setUsername("user1");
> >> x.setPassword("pw1");
> >> entitySave(x);
> >>
> >> It was working at first, so I decided to delete the database from the
> SQL
> > side
> >> (via Management Studio).
> >>
> >> So now, when I reload test.cfm, I get this error:
> >>
> >> Error in executing the DDL.[Macromedia][SQLServer JDBC
> >> Driver][SQLServer]Identity column 'AccountID' must be of data type int,
> >> bigint, smallint, tinyint, or decimal or numeric with a scale of 0, and
> >> constrained to be nonnullable.
> >> I tried changing dbcreate to "dropcreate", and I get the same error, but
> > this
> >> new message is there as well:
> >>
> >> [Macromedia][SQLServer JDBC Driver][SQLServer]Cannot drop the table
> >> 'dbo.Account', because it does not exist or you do not have permission.
> >>
> >> How do I get it working again? I tried restarting the service, but that
> > did not
> >> help. I even recreated the table, and CF dropped it but I still get the
> > "Error in
> >> executing the DDL" error.
> >>
> >> Thanks!
> >>
> >>
> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> ~~~~~~~~~~~|
> >> 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:341870
> >> Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
> >> Unsubscribe: http://www.houseoffusion.com/groups/cf-
> >> talk/unsubscribe.cfm
> >
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:342135
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to