• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unable to find entity for object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Unable to find entity for object (From: Owen McKerrow <email@hidden>)

  • Prev by Date: Re: Unable to find entity for object
  • Next by Date: Re: Re: Unable to find entity for object
  • Previous by thread: Re: Unable to find entity for object
  • Next by thread: Re: Re: Unable to find entity for object
  • Index(es):
    • Date
    • Thread