Testing for Valid Objects

From: Orion Fields (ofield..martserv.com)
Date: Fri Aug 06 2004 - 13:59:50 EDT

  • Next message: Mike Kienenberger: "Re: Testing for Valid Objects"

    Hi all. I've got a newbie-esque question to pose. In 1 to many or many
    to many relationships, it's easy to test if there is corresponding data
    in the list. Ie, myobject.getArtistArray().isEmpty();

     

    However, for the many to single or single to single relationships, how
    does one go about testing to see if the object exists?

     

    What I have is a try catch block around the resolveFault of the object
    which may or may not exist. I'd rather not catch a
    cayenneruntimeexception for this. Is there a better way, prefetching
    aside? (I say prefetching aside b/c the object is nested a few objects
    down. I tried the read property, ie myobject.readProperty("Artist"), but
    that doesn't returns the same hollow object as myobject.getartist.

     

    Orion



    This archive was generated by hypermail 2.0.0 : Fri Aug 06 2004 - 13:59:50 EDT