geekiness mishaps Uncategorized

enums vs enums

So I thought enums were cool.

But now this: I have this nice enum representing the network protocol a service is using. I am talking about a java enum here. Now I want to store the protocol in the database. Hey databases support enums, too, me thinks! Cool. Enum here, enum there. Everything’s fine.

Nooo, stop! Nothing’s fine.

It’s easy to store the java enum if you chose the names in the database identical (which is easy and not even counterintuitive).

But wait until you try to retrieve the stupid thing. All you get is a f…… string. Great and now? Maybe an update to the sql drivers would be in order? Or am I missing some feature of java enums? Like ….?

edit: a solution has been found


Okay. But where the f… is the documentation for this type of thing???? And why is Eclipse on a “I hate this user trip” against me?

By Yashima

Writer of code and stories