READrepresent lowest possible access level.
READaccess, and of course
READaccesses together. Now imagine SQL query which selects all documents where user specified by ID has access specified by accessLevel:
If access level is stored in database as string the query above isn't correct. But when we replace string representation by numbers, query works as expected.
How to alter standard behavior of MyBatis to map some java enumeration types as a string? Answer is: by implementing custom TypeHandler:
It would be nice if we can register the handler with specific java enumeration types like this:
But the configuration above is not valid yet! You have to implement your own EnumOrderTypeHandler and extend it for every java enumeration type:
and than register extended handler: