Enumerations ...

From: Michael Gentry (Yes, I'm a Contractor) ("Michael)
Date: Sat May 07 2005 - 10:40:32 EDT

  • Next message: Andrus Adamchik: "Cayenne 1.2M4 release"

    If anyone is using (or trying to use) my Enumerations example on the wiki, I
    found a problem with it which didn't trip my overly-simplistic (it seems)
    test cases. I'll try to patch the uploaded tar on the wiki soon, but until
    then, you can patch the classes yourself. Replace the following methods:

    IntegerEnumeration.java:

    public Object materializeObject(ResultSet resultSet, int index, int type)
    throws Exception
    {
      int value = resultSet.getInt(index);

      return resultSet.wasNull() ? null : getEnumerationByValueForClass(new
    Integer(value), getClass());
    }

    public Object materializeObject(CallableStatement callableStatement, int
    index, int type) throws Exception
    {
      int value = callableStatement.getInt(index);

      return callableStatement.wasNull() ? null :
    getEnumerationByValueForClass(new Integer(value), getClass());
    }

    StringEnumeration.java:

    public Object materializeObject(ResultSet resultSet, int index, int type)
    throws Exception
    {
      String value = resultSet.getString(index);

      return resultSet.wasNull() ? null : getEnumerationByValueForClass(value,
    getClass());
    }

    public Object materializeObject(CallableStatement callableStatement, int
    index, int type) throws Exception
    {
      String value = callableStatement.getString(index);

      return callableStatement.wasNull() ? null :
    getEnumerationByValueForClass(value, getClass());
    }

    Also, I'm working on a Tapestry PropertySelection model to work with the
    Cayenne enumerations. I've got it working (which is how I ran across the
    problem), but it's not complete yet. If you need a copy of it, though, let
    me know and I can send as-is. I'll add it to the wiki when it is more
    complete.

    Thanks,

    /dev/mrg



    This archive was generated by hypermail 2.0.0 : Sat May 07 2005 - 10:40:45 EDT