Well, when mapping to legacy DBs, we can't always control the mapping.
 I'd much rather have usable/readable names in the Java code even if
the backend is more obscure.  Using the enumerated name or index isn't
always desirable or even possible, either.  To use a real-world
example from my code:

  public static final DateFrequencyEnumeration NA           = new
DateFrequencyEnumeration("NA",           new Integer(0));
  public static final DateFrequencyEnumeration ANNUALLY     = new
DateFrequencyEnumeration("ANNUALLY",     new Integer(1));
  public static final DateFrequencyEnumeration SEMIANNUALLY = new
DateFrequencyEnumeration("SEMIANNUALLY", new Integer(2));
  public static final DateFrequencyEnumeration QUARTERLY    = new
DateFrequencyEnumeration("QUARTERLY",    new Integer(4));
  public static final DateFrequencyEnumeration MONTHLY      = new
DateFrequencyEnumeration("MONTHLY",      new Integer(12));
  public static final DateFrequencyEnumeration SEMIMONTHLY  = new
DateFrequencyEnumeration("SEMIMONTHLY",  new Integer(24));
  public static final DateFrequencyEnumeration BIWEEKLY     = new
DateFrequencyEnumeration("BIWEEKLY",     new Integer(26));
  public static final DateFrequencyEnumeration WEEKLY       = new
DateFrequencyEnumeration("WEEKLY",       new Integer(52));

I hope that comes over OK.  The index positions can't be used.  The
actual DB values are 0, 1, 2, 4, 12, 24, 26, and 52.  And fixed in
stone, so-to-speak.  This doesn't correspond to the name or the index
position.  I'd much rather see WEEKLY in the code and let Cayenne
translate that for me to 52.

I'm not trying to be argumentative, just illustrative.  :-)

Thanks,

/dev/mrg


On 8/9/07, Andrus Adamchik <[EMAIL PROTECTED]> wrote:
> Well, it won't use a user defined attribute ("newName" in your case).
> It will use either ENUM name - "FEMALE" or "MALE", or enum index.
>
>
> > Notice for the gender column it didn't use "F" or "M" as the value.
> > It used [EMAIL PROTECTED] and
> > [EMAIL PROTECTED]
>
> This is likely a logging artifact.
>
> Andrus

Reply via email to