Announcement Announcement Module
Collapse
No announcement yet.
Spring Data MongoDB - Property Editor Support? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data MongoDB - Property Editor Support?

    I've been taking the plunge into using MongoDB and I got a simple example working writing to and from mongo. Now I need to know how to manage property editors for the conversion? I'm not sure if it's supported but it looks like you guys have done it in the examples with TradeBatch. But you don't seem to be using a repository.

    Do you have any suggestions on registering property editors? Or should I just make my object incredibly flat and marshal myself?

  • #2
    After some research it looks like it should be supporting property editors out of the box. In the Person example they have an Address object which is set and then persisted and retrieved.
    In my example I have an object FeedItem and a Comment object inside. A straightforward bean. However, when I save the object to my feedItemDaoRepositoryImpl I get this error:

    Unable to map property dislike. Skipping.


    Here is the code:

    feedItemDaoRepositoryImpl.deleteAll();
    for (int i = 0; i < 100; i++) {
    FeedItem feedItem = new FeedItem();
    feedItem.setTitle("Test " + i);
    TotComment totComment = new TotComment();
    totComment.setId(1L);
    totComment.setComment("howdy");
    feedItem.setTotComment(totComment);
    feedItem.setFeedItemType(FeedItemType.COMMENT);
    feedItemDaoRepositoryImpl.save(feedItem);
    }

    List<FeedItem> items = feedItemDaoRepositoryImpl.findAll();

    Any ideas?

    Comment


    • #3
      Hi,

      currently SimpleMongoConverter only writes properties that has a getter method to expose it. This will change in upcoming milestones when we have sophisticated mapping options.

      Cheers,
      Ollie

      Comment


      • #4
        Shoot. Do you guys have an ETA on when thight might happen?

        Comment


        • #5
          It's in the works already. We just have created a ticket you might wanna follow. EVA is M2.

          Cheers,
          Ollie

          Comment

          Working...
          X