I wrote a generic EnumTypeHandler some time ago which made things quite a bit easier. I don't have access to the source right now but I'll try to dig it out this evening if needed, it's fairly basic and straightforward (and I think even based off some protoype handler I found somewhere else).
Otherwise I could never think of another way of doing it. I think overall though it is a nice way to abstract out the handling of custom types, even if Enums could be considered first class they do afford some magic that would be difficult to handle in a standard way. Cheers, -Ed 2010/1/18 Stephen Friedrich <stephen.friedr...@fortis-it.eu> > By default iBATIS expects enums to be stored in the DB using the enum > _names_. > > I am working with a legacy DB where the enum's ordinal is stored instead. > > > > On a global level I managed to do this by patching the default > EnumTypeHandler. > > > > The only alternative that I currently see is to write a specific type > handler > > for each single enum used in the project. This can't really be the ultimate > > > solution. > > > > Is there a better solution that I have missed so far? > > I can't register a typehandler for the "Enum" base class, because iBATIS > only ever > > compares to the concrete class. > > > > Shouldn't there be a built-in, quick way to configure either ordinal or > name > > on a mapper level? >