Sorry I just reread your question. Not in the state it is in no, what you will need to do is write a method to do a search for that email first. The assumption then would be that if you do something along the lines of this.
What you could do is replace the new Domain() and new Email() with EntityLoads, this way you can get an empty entity back. I can't remember if it returns null or an empty entity. So then you can either create the entity if its null, or just do what you need to do. I guess there are many ways to do what you are doing, but I think the amount of DB calls you were making can potential be harmful if evedr you need to scale your project. On Thu, Dec 17, 2009 at 12:52 PM, Charlie Stell <[email protected]>wrote: > > Maybe ORM will do more than I originally thought... If I start with two > empty tables - domain and email, and get an email from > [email protected](curDomain-gmail.com, curUser-xyz), and the code below > runs, two records > will be inserted (one in each table). > And then later on, I get an email form [email protected], I can run this exact > same code and it will know not to insert a new record into domain? > > domain = entityNew("domain"); > > domain.setName(curDomain) > > email = entityNew("email") > > email.setDomain(domain); > > email.setUser(curUser); > > domain.save(); > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:329207 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

