In this recipe, we will use a JPA provider that allows us to use JPA entities to achieve object-to-document mapping with MongoDB.
Start the standalone server instance that listens to port
27017. This is a Java project using JPA. Familiarity with JPA and its annotations is expected, though what we will be looking at is fairly basic. Refer to the Connecting to a single node from a Java client recipe in Chapter 1, Installing and Starting the MongoDB Server, to know how to set up Maven if you are not aware of it. Download the
DataNucleusMongoJPA project from the code bundle provided with the book. Though we will execute the test cases from the command prompt, you may import the project in your ...