Announcement Announcement Module
Collapse
No announcement yet.
mapping list of enums Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • mapping list of enums

    Hi,

    spring-data 1.0.0.M3 with MongoDB. How come spring can map this class:

    Code:
    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 for this one with
    java.lang.IllegalArgumentException: can't serialize class org.springframework.data.document.mongodb.index.In dexDirection

    Code:
    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});
      
    }
    The same applies to other collections, and also arrays. Obviously spring can map this enum,
    so writing a mapper doesn't solve the problem. Is this a bug or there's a way to map a collection (set/map) holding enums?


    thanks,
    ms
    Last edited by amavisto; Jul 19th, 2011, 11:59 AM.
Working...
X