tags:

views:

226

answers:

1

I have no experience with MongoDB and we are trying to port a JPA application to be based on MongoDB. There are 3 drivers mentioned for porting java here. Which driver would be the easiest to use for converting my existing JPA application? Would it be morphia, mungbean or daybreak. Would prefer some practical experiences with users who have gone through this path before.

+2  A: 

Morphia isn't a driver but a wrapper around the official java driver. It has a pretty active community.

Mungbean is an alternative community supported driver and POJO mapper. Having written a community supported driver myself, I wouldn't say that, that is necessarily a bad thing but it is like any open source project. You have to look at the vitality of the project.

Daybreak claims to be very new and experimental. Unless you have the stomach for it, I wouldn't touch it (yet).

The existing plain java driver is basic but has all the functionality. 10gen is working on a redo of it to address some of the warts of the old one. You may also want to look into that.

Some things you need to consider when using a mapper:

  • How easy is it to setup?
  • Can I override names?
  • Can some fields be marked as not persisted?
  • What happens to the data if it is in the document but not mapped in the static object? Does it get lost on a save?
  • (Advanced) Can I plug into the configuration engine to do custom serialization? You may want to do that if you have existing POJOs that already have attributes for another persistence engine or serializer.
Sam Corder
@Sam - thanks for the detailed response, I will start my prototypes with Morphia
Samuel