Re: Unable to find entity for object
Re: Unable to find entity for object
- Subject: Re: Unable to find entity for object
- From: Art Isbell <email@hidden>
- Date: Thu, 29 Jun 2006 08:25:45 -1000
On Jun 28, 2006, at 9:09 PM, Owen McKerrow wrote: EOEditingContext ec = new EOEditingContext(); AuditLog newLog = (AuditLog) EOUtilities.createAndInsertInstance(ec,"AuditLog"); newLog.setPerson((Person)EOUtilities.localInstanceOfObject(ec,((Session)session()).currentPerson())); newLog.setEntityName("TestEntity"); newLog.setIpAddress(((Session)session()).getIPAddress(context().request())); newLog.setAttributeName("TestAttribute"); newLog.setNewValue("NewValue"); newLog.setOldValue("OldValue"); ec.saveChanges();
Others have suggested some solutions. To avoid other potential problems, lock your new editing context prior to using it and unlock it afterward, and invoke ec.saveChanges() in a try-catch block. Maybe you just omitted these statements to simplify your example.
EOEditingContext ec = new EOEditingContext(); ec.lock(); try { AuditLog newLog = (AuditLog) EOUtilities.createAndInsertInstance(ec,"AuditLog"); ... try { ec.saveChanges(); } catch (RuntimeException anException) { // Deal with exception } } finally { ec.unlock(); }
Aloha, Art
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden