Re: recall object without pk

From: Mike Kienenberger (mkienen..laska.net)
Date: Mon Aug 23 2004 - 13:55:58 EDT

  • Next message: David Norwood: "JBoss transactions"

    dragos moraru <moraru_et..pymac.com> wrote:
    > I'm new to Cayenne and i want to recall an object from the database.
    > I saw on the forum that the usage of the PK is not very smart. Please tell
    me how to recall in a web application a particular object from DB using
    another method . Some guys suggested to use the hashCode. But how?

    We'd need more specifics on what you're trying to do.

    Normally, you'd just follow the relationship from an existing object, or
    you'd use a query.

    Ie,

    Artist artistOfPainting = painting.artist();

    or

    Expression artistNamesBeginningWithDQualifier =
    ExpressionFactory.likeIgnoreCaseExp("artistName", "D%")
    SelectQuery artistNamesBeginningWithDQuery = new SelectQuery(Artist.class,
    artistNamesBeginningWithDQualifier);
    List artistsBeginningWithDList =
    aDataContext.performQuery(artistNamesBeginningWithDQuery);

    -Mike



    This archive was generated by hypermail 2.0.0 : Mon Aug 23 2004 - 13:55:23 EDT