Prev: Is there any ActiveRecord implementation for java?
Next: CFP: PPPJ 2010 -- Principles and Practice of Programming in Java (Vienna, Sep 10)
From: Arne Vajhøj on 2 Jan 2010 20:56 On 18-12-2009 23:51, Lew wrote: > Martin Gregorie wrote: >> On Sat, 19 Dec 2009 01:27:13 +0000, Arved Sandstrom wrote: >>> david.karr wrote: >>>> Quite often databases will have columns that are stored as integers, >>>> but represent enumerated values. In object-relational mapping, it's a >>>> good idea to translate that integer value to the enumerated value it >>>> represents. >>> [ SNIP ] >>> >>> It's an even better idea to store the enumeration "name" as a varchar. >>> >> Agreed - and hold the integer:name mapping as a separate table. > > Or don't even bother with integers in the database at all, but just use > the VARCHAR value. Depending on the database using int referring with a table mapping to varchar may provide better possibilities for constraints in the database. Arne |