• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin

Mongo db entity relationship implementation using Spring data

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am learning Spring with mongo db and i'm feeling difficulty in learning entity relationship model. Can anyone teach me how can i implement the following design.

Person collection A person class

   List of sports object

Sport collection A Sport class

   id (Auto generated)
   sport name

while i am saving the person class which contains sport class, Sport entity should be saved in Sport collection if it is not already present and Person entityShould be stored in Person collection with Sport objects Reference.

While i am retrieving Person class, associated sport class should be fetched from corresponding collection. I have tried with @DBRef and it is not worked for me. It will be very helpful if anyone teach me this scenario or giving the reference to learning this concepts.

Very thanks in advance.
Posts: 78649
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think your question would set better in our Mongo forum, and it might be duplicated into other fora too. But implementing those features in a class shouldn't be difficult. How far have you got?
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
a bit of art, as a gift, the permaculture playing cards
    Bookmark Topic Watch Topic
  • New Topic