Do you need JPA when using MongoDB?
I'm quite confused between those two. I'm looking at the 开发者_运维技巧Play! java framework and it says it uses JPA. I'm thinking about using Play! and MongoDB for the first time in a project. I've used JPA before, but I was using it back then to write to a relational database(mysql).
MongoDB is not a relational database, so if I want to use it with Play!, will I still be needing JPA? Or just the MongoDB driver?
I think I'm confusing quite a few things here, so if someone could help clarify things, I'd appreciate it!
I think play has support for JPA, but doesn't require JPA. You can just forget about JPA altogether and use whatever API to MongoDB you like (its native API, Brendan's suggestion of Morphia, etc).
As MongoDB is not a relational database, it does not have support for JPA.
There is however Morphia, an Object Document Mapper for MongoDB + Java which closely emulates the JPA model but using MongoDB appropriate semantics. It is known to work well with Play and if you want this kind of Object mapping would be an excellent analog.
DataNucleus already supports MongoDB, for JPA and JDO, the standardised APIs in Java. With that you have portability, unlike with the other APIs
EclipseLink is planning support for MongoDB from JPA.
See, http://wiki.eclipse.org/EclipseLink/DesignDocs/362899
You don't need JPA when programming only to MongoDB. But if you have used JPA before then you should consider using PlayMorphia module as it's API is carefully designed to make JPA programmer feel like programming at home. Again PlayMorphia is NOT a JPA implementation, it just looks like it.
Check it out at http://www.playframework.org/modules/morphia. And also the documentation of the latest version
Hibernate OGM provides JPA for MongoDB. MongoDB University has a course for Java Developers, maybe it will help you understand what you want to do.
精彩评论