I see what you are saying. I guess for your case you can keep using
custom ExtendedType (only based on JDK 1.5 enums).
Andrus
On Aug 9, 2007, at 6:35 PM, Michael Gentry wrote:
> 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 <andru..bjectstyle.org> 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 test.GenderEnumeratio..551336 and
>>> test.GenderEnumeratio..974996.
>>
>> This is likely a logging artifact.
>>
>> Andrus
This archive was generated by hypermail 2.0.0 : Thu Aug 09 2007 - 11:57:44 EDT