Re: reverse engineering of id to what type?

From: Mike Schrag (mschra..dimension.com)
Date: Sat Nov 22 2008 - 18:52:23 EST

  • Next message: Xavier Destombes: "Re: Maclipse 3.4.1"

    > I can create a table in MySQL like this:
    >
    > create table Thing (id int primary key, name varchar(64));
    >
    > If I then reverse-engineer that table into an EOModel in a 'Wonder
    > Application', I get an entity that has an attribute named "id", but
    > its external type is "java.lang.Long" and its valueType is "l".
    >
    > I expected a java.lang.Integer and I usually end up fixing these
    > myself, or later on I add some foreign key and I get a run-time
    > exception because Long != Integer. Of course, the exception message
    > is a very friendly "this might not be a big thing, but you want to
    > fix this", but it is inconvenient.
    >
    > If I wanted a java.lang.Long, I would have used a "longint" in the
    > column definition. Perhaps some databases do not have two types of
    > integers, but most do. Could the smart thing happen for database
    > that have different kinds of integer types? There could be some
    > default behavior (as exists now) for databases that only have one
    > integer type.
    >
    > So, am I wrong? Is this a bug or do people think that I should
    > always be getting a java.lang.Long?
    The core of reverse engineering comes entirely from EOF core ... You
    could try running the reverse engineer API's manually* and see if it
    produces longs or not (though I suspect it does). If that's the case,
    then you'd probably need to do some work in the schema sync impl for
    mysql.

    ms

    * private EOAdaptorChannel _channel;
    ...
    NSArray tableNamesArray = _channel.describeTableNames();
    EOModel eofModel =
    _channel.describeModelWithTableNames(tableNamesArray);



    This archive was generated by hypermail 2.0.0 : Sat Nov 22 2008 - 18:53:04 EST