Results 1 to 5 of 5

Thread: Spring Data MongoDB - Property Editor Support?

  1. #1
    Join Date
    Apr 2010
    Posts
    12

    Default 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. #2
    Join Date
    Apr 2010
    Posts
    12

    Default

    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?

  3. #3
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    492

    Default

    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

  4. #4
    Join Date
    Apr 2010
    Posts
    12

    Default

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

  5. #5
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    492

    Default

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

    Cheers,
    Ollie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •