ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Friedrich <stephen.friedr...@fortis-it.eu>
Subject enums as ordinals?
Date Mon, 18 Jan 2010 11:50:32 GMT
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?

Mime
View raw message