Re: Cayenne Enumerations

From: Mike Kienenberger (mkienen..laska.net)
Date: Tue Jun 14 2005 - 11:33:40 EDT

  • Next message: Gentry, Michael \(Contractor\): "RE: Cayenne Enumerations"

    Andrus Adamchik <andru..bjectstyle.org> wrote:
    > But even with a template I still don't understand where would you get the
    > enum info. E.g. if you have a color enum (RED -> 1, GREEN -> 2, BLUE ->
    > 3), there is nothing in the DataMap that would allow you to generate such
    > class.

    I probably should have been more clear about the enumeration generation
    tool:

    You'd have it do something along the lines of "select distinct COLUMN from
    TABLE" from the datasource. -- those would be your enumerations. At least,
    I'm guessing that's what Michael had in mind.

    #foreach ($enumerationValue in
    $enumerationGeneratorTool.fromDistinctColumnValues(DATASOURCEINFO, TABLE,
    COLUMN))

    Or from a property file:

    #foreach ($enumerationValue in
    $enumerationGeneratorTool.fromPropertiesFile(FILENAME))

    etc

    -Mike



    This archive was generated by hypermail 2.0.0 : Tue Jun 14 2005 - 11:31:07 EDT