Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Spring and MongoDB manual references

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I need advice on doing manual references in mongodb with spring without using dbrefs.

If for example, I have two document collections:

User {
addresses: [addressId1, addressId2...]

Address {

So, user has 1 or more addresses. In user document, I want to use array of address ids.

Now, there is a question of inserting, updating and retrieving user document.

For insertion, I would need one POJO which has addresses as array of ids (array of ObjectIds, Strings..).

For retrieving, sometimes I need full document with addresses eagerly populated. For this case I would need different POJO which has addresses as array of address objects.

Is there any good approach to this? Any pieces of advice?
Evil is afoot. But this tiny ad is just an ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!