Re: Coldfusion9 ORM

2009-08-19 Thread Manjukiran Pacchhipulusu

Hi Gavin,

I tried this and it works for me.  Can you try a couple of things:
- Set ormsettings.logSQL=true in this scope of Application.cfc.  Check if the 
SQLs are getting generated fine.
- You need not do but still try calling ormflush() after EntitySave() in 
postinsert method.
If you still cannot find out the problem, please post a repro case of the issue.

Thanx
-Manjukiran (www.manjukiran.net)
ColdFusion Product Team 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325557
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Coldfusion9 ORM

2009-07-24 Thread Kumar Shah

Be sure to turn on event handling in Application.cfc,
this.ormsettins.eventhandling = true;

On Fri, Jul 24, 2009 at 4:27 AM, Gavin Stewart gavin.stew...@gmail.comwrote:


 Hello there,

 I have a question about cf9 orm. I am trying to add a postInsert() event on
 a persistent cfc which basically logs the action in an audit table. My code
 looks like this.

 public void function postInsert(){
  //log the action
  Audit=entitynew('Audit');
  Audit.setItem_type('Art');
  Audit.setAction('create');
  Audit.setDate_actioned(now());
  Audit.setUser(this.getLast_actioned_by());
  Audit.setPage(this);
  entitysave(Audit);
 }

 This does not work and and do not know why. When I dump the Audit object,
 it is there and looks perfect but it does not save it to the database. In
 the docs under 'Event Handling in CFC' it says Note:  When you call the
 EntitySave() method on an object that is not loaded using EntityLoad(), it
 gets updated but the intercepter call fails. This happens because an empty
 map is created for the object and there is no previous data associated with
 it. 

 I have no idea what this means. Does this mean that you cannot save or
 create another object in an event handler?

 Thank you in advance for any advice
 Gavin

 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324920
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Coldfusion9 ORM

2009-07-24 Thread Gavin Stewart

Be sure to turn on event handling in Application.cfc,
this.ormsettins.eventhandling = true;

I have done this and it does definatley trigger the event. I can dump out the 
Audit object in the event handler and I see it there. It just doesnt save to 
the database. There are no errors, logs or any reasons why it has not been 
saved to the database 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324921
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: Coldfusion9 ORM

2009-07-24 Thread brad

1)  Are you sure you are looking at the correct data source?
2) Have you run a trace on the database while the page execute to
confirm if _any_ SQL is being run?

~Brad

 Original Message 
 Subject: Re: Coldfusion9 ORM
 From: Gavin Stewart gavin.stew...@gmail.com
 Date: Fri, July 24, 2009 6:44 am
 To: cf-talk cf-talk@houseoffusion.com
 
 
 Be sure to turn on event handling in Application.cfc,
 this.ormsettins.eventhandling = true;
 
 I have done this and it does definatley trigger the event. I can dump
out the Audit object in the event handler and I see it there. It just
doesnt save to the database. There are no errors, logs or any reasons
why it has not been saved to the database 
 


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324926
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Coldfusion9 ORM

2009-07-24 Thread Gavin Stewart

1)  Are you sure you are looking at the correct data source?
2) Have you run a trace on the database while the page execute to
confirm if _any_ SQL is being run?

1) Yes as far as i know you can only use one data source in orm.
2) The insert statement gets executed in the object but the Audit object does 
not get saved on the postInsert() event. 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:324930
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4