[jira] Created: (CAY-1018) Enums fetched via SQLTemplate

From: Andrus Adamchik (JIRA) ("Andrus)
Date: Fri Mar 28 2008 - 12:13:39 EDT

  • Next message: Michael Gentry: "Re: [jira] Created: (CAY-1018) Enums fetched via SQLTemplate"

    Enums fetched via SQLTemplate
    -----------------------------

                     Key: CAY-1018
                     URL: https://issues.apache.org/cayenne/browse/CAY-1018
                 Project: Cayenne
              Issue Type: Bug
              Components: Cayenne Core Library
        Affects Versions: 3.0
                Reporter: Andrus Adamchik
                Assignee: Andrus Adamchik
                 Fix For: 3.0

    This is not specifically enum related, but is is very easy to demonstrate the problem using enums... E.g.:

           SQLTemplate q = new SQLTemplate(
                    EnumEntity.class,
                    "SELECT * FROM ENUM_ENTITY WHERE ENUM_ATTRIBUTE = 'one'");
            q.setColumnNamesCapitalization(SQLTemplate.UPPERCASE_COLUMN_NAMES);

            EnumEntity e = (EnumEntity) DataObjectUtils.objectForQuery(context, q);
            assertNotNull(e);
            assertSame(Enum1.one, e.getEnumAttribute());

    The last line throws ClassCastException as the enum value was stored as String. Essentially the problem is that SQLTemplate is created without a result set mapping, and doesn't bother to look at the root entity for type mapping...

    -- 
    This message is automatically generated by JIRA.
    -
    You can reply to this email to add a comment to the issue online.
    



    This archive was generated by hypermail 2.0.0 : Fri Mar 28 2008 - 12:15:59 EDT