13.07.2015 Views

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

Spring Data MongoDB - Spring Web Services - Parent - SpringSource

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

please define productname in your docbook file!Finally, you need to configure your project to use <strong>MongoDB</strong> and also configure the aspects that areused. The following XML snippet should be added to your application context:......Example 8.3 Example application context with <strong>MongoDB</strong> and cross-store aspect support8.2 Writing the Cross Store ApplicationWe are assuming that you have a working JPA application so we will only cover the additional stepsneeded to persist part of your Entity in your Mongo database. First you need to identify the field youwant persited. It should be a domain class and follow the general rules for the Mongo mapping supportcovered in previous chapters. The field you want persisted in <strong>MongoDB</strong> should be annotated using the@RelatedDocument annotation. That is really all you need to do!. The cross-store aspects take careof the rest. This includes marking the field with @Transient so it won't be persisted using JPA, keepingtrack of any changes made to the field value and writing them to the database on succesfull transaction1.4.0.BUILD-SNAPSHOT<strong>Spring</strong> <strong>Data</strong> <strong>MongoDB</strong> -Reference Documentation 90

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!