Hello and help with classcastexception and a couple of other questions

From: Gowry Gabriev (gowry.gabrie..mail.com)
Date: Tue Jul 27 2004 - 22:44:08 EDT

  • Next message: Andrus Adamchik: "Re: Hello and help with classcastexception and a couple of other questions"

    Hello,

    I've just started using Cayenne in the last couple of days, and I'm
    having a problem
    with SqlSelectQuery in version 1.0.7.

    I have a really long sqlserver query that strips characters out of
    fields and selects
    records that all have, for example, the same last name. The query runs
    and returns
    its result set. However, when I try to cast the results back to the
    correct class
    I get a classcastexception. Is this because there isn't a sqlserver adapter?

    If I remember off the top of my head my code looks like:
       SQLSelectQuery myQuery = new SQLSelectSquery(MyClass.class,"really
    long query");
       List duplicates = dataContext.executeQuery(myQuery);
       User u = (User)duplicates.get(0);

    Duplicates seems to be composed of Maps. I searched through the documentation
    but didn't find anything that helps. Hopefully I haven't overlooked
    something really
    obvious :(

    Also, if my database is set up to autogenerate PKs for everything how
    do I do configure
    this and keep the modeler happy? I have no control over how the keys
    are generated for
    this app.

    And one last question...this is me being overly paranoid about stuff
    I'm use to controlling.
    How does Cayenne generate it's PKs? Does it take blocks of sequences
    from the database
    to reduce the number of round trips?

    So far I'm pretty happy with Cayenne. It seems very intuitive. I wish
    there were more
    written about how it works behind the scenes, but I'm sure I'll
    discover things as I go.

    Thanks!

    Gowry



    This archive was generated by hypermail 2.0.0 : Tue Jul 27 2004 - 22:44:09 EDT