ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MrNobody <tony.loz...@pepsi.com>
Subject How do you suggest working with enums?
Date Wed, 05 Dec 2007 16:14:32 GMT

If I have an enum to represent a lookup table, like:

public enum Color {
  RED (1, "Red"),
  GREEN (2, "Green"),
  BLUE (3, "Blue");
}

What is the best practice for both writing this enums into the database and
instantiating enums for the values read from the databse, using iBATIS ?

Somewhere, something would have to convert that Color to it's ID (like 3 for
Blue) when writing to the DB, and someone else will have to create a enum
base don the ID read (3 to Color.BLUE)

Any suggestions?

-- 
View this message in context: http://www.nabble.com/How-do-you-suggest-working-with-enums--tf4950616.html#a14174681
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message