Re: Hello and help with classcastexception and a couple of other questions

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jul 27 2004 - 23:28:18 EDT

  • Next message: Andrus Adamchik: "Re: ObjectVisualizer - new query tool supports Cayenne"

    Hi Gowry,

    First advise is to upgrade to 1.1B2 -
    http://prdownloads.sourceforge.net/cayenne/cayenne-1.1B2.tar.gz . It is
    actually pretty stable (I know a few people who use 1.1 in production
    for a while), and solves many of the problems you mention below. And
    the Modeler is much nicer in 1.1 ;-)

    > 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.

    SqlSelectQuery is deprecated in 1.1 exactly because it wasn't usable.
    Please upgrade to 1.1 and use SQLTemplate instead. It is everything
    SlqSelectQuery is not. It allows to fetch real DataObjects (not just
    maps, aka "data rows"), and much more:

    http://objectstyle.org/cayenne/userguide/fetch/sqltemplate.html
    http://objectstyle.org/cayenne/userguide/fetch/sqltemplate-
    scripting.html

    Also in 1.1 Modeler supports storing queries in the DataMap, including
    SQLTemplate. So you can avoid hardcoding the SQL in the Java code.

    > Also, if my database is set up to autogenerate PKs for everything how
    > do I do configure this and keep the modeler happy?

    Do you mean you have "identity" columns that increment automatically on
    every INSERT, or is this something else? If that's the case there are
    some bad news - Cayenne doesn't support identity columns yet. There is
    lots of interest lately to get this done (
    http://www.objectstyle.org/cayenne/lists/cayenne-user/2004/06/0192.html
    ), so maybe sometime early in the fall...

    > 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?

    Yes, that's correct. How the sequence is obtained is DB specific, but
    that's the general idea behind Cayenne auto PK generation.

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Jul 27 2004 - 23:28:23 EDT