RE: another beginner orm question

2010-01-14 Thread mark

I have, but I have made several changes to the cfc's, which have not been
reflected in the database.  I put ormFlush() at the top of application.cfc,
is there some other way to make sure a new mapping/new database  is created?
I have  in application.cfc as
well.  But I look at the database and the changes are not reflected.

I want to use the ORM to create the database so I am forced to start
thinking about objects all the time.  I want to create Flex front ends for
my web apps and that is all OOP.  It is a very hard leap for a small and
smooth, well aged brain.

Mark

-Original Message-
From: b...@bradwood.com [mailto:b...@bradwood.com] 
Sent: Thursday, January 14, 2010 1:43 PM
To: cf-talk
Subject: RE: another beginner orm question


> ids for this class must be manually assigned before calling save(): Emails


Have you defined which property in your components are the primary key?

~Brad







~|
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:329689
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: another beginner orm question

2010-01-14 Thread brad

> ids for this class must be manually assigned before calling save(): Emails 

Have you defined which property in your components are the primary key?

~Brad





~|
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:329685
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


another beginner orm question

2010-01-14 Thread Mark Fuqua MdProfinish

Ok, got past last problem (thanks dave) and have uncommented the code on
index.cfm.  I followed the example on Manju's blog entitled Coldfusion-ORM:
Define One-to-Many and Many to One Relationships.  The article was for one
related table, mine is for three.  I used the built-in Apache database.  The
orm is creating the tables, though it doesn't seem to be reflecting my
latest changes.  Anyway, the code is below the error. 

 

Thanks,

 

Mark

 

ids for this class must be manually assigned before calling save(): Emails 

Root cause :org.hibernate.id.IdentifierGenerationException: ids for this
class must be manually assigned before calling save(): Emails   The error
occurred in C:\ColdFusion9\wwwroot\Orm\index.cfm: line 48

46 :   */

47 :   

48 :   EntitySave(newContact);

49 :

50 :   

 

 

Code for index.cfm (just a test for learning):

 

 





/*

Create a Contact with one address, one phone number
and one email address

*/



newContact = new Contacts();

newContact.setFirstName("Mark");

newContact.setLastName("Fuqua");



newAddress = new Addresses();

newAddress.setAddressDescription("2301 Mount Carmel
Road");

newAddress.setCity("Parkton");

newAddress.setState("MD");

newAddress.setZip("21120");



newEmail = new Emails();

newEmail.setEmailDescription("Work Email");

newEmail.setEmail("m...@mdprofinish.com");



newPhoneNumber = new PhoneNumbers();

newPhoneNumber.setPhoneDescription("Cell");

newPhoneNumber.setPhoneNumber("410-215-7356");



/*

Associate the Addresses, Emails and
PhoneNumbers with Contacts

*/



newContact.addaddresses(newAddress);

newContact.addEmails(newEmail);

newContact.addphoneNumbers(newPhoneNumber);



/*

Establish the relationship from the
other side

*/



newPhoneNumber.setContacts(newContact);

newAddress.setContacts(newContact);

newEmail.setContacts(newContact);



/*

Save new Contacts, email, address, phone
info should be saved as well

*/



EntitySave(newContact);





DisplayContacts();   



  




~|
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:329681
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4