how to map a collection of enums in spring-data for mongodb -
spring-data 1.0.0.m3 mongodb. how come spring can map class:
import org.springframework.data.document.mongodb.index.indexdirection; import org.springframework.data.document.mongodb.mapping.document; @document public class enumsmapper { private indexdirection d = indexdirection.ascending; }
and fails one:
import org.springframework.data.document.mongodb.index.indexdirection; import org.springframework.data.document.mongodb.mapping.document; import java.util.list; import java.util.arrays; @document public class enumsmapper { list<indexdirection> list_enum_test = arrays.aslist( new indexdirection[] {indexdirection.ascending}); }
with a:
java.lang.illegalargumentexception: can't serialize class org.springframework.data.document.mongodb.index.indexdirection
the same happens other collections (sets, ...), , arrays. spring can map enum, writing mapper doesn't solve problem. bug or there's way map collection (set/map) holding enums?
it seems discovered bug :). here's the bug, here's the fix. snapshot binaries deployed our maven repo. feel free give try , add comments ticket in case you're still missing something.
Comments
Post a Comment