Results 1 to 2 of 2

Thread: Save dociuments using (@DBREF) DB Reference

  1. #1
    Join Date
    Mar 2013
    Posts
    20

    Default Save dociuments using (@DBREF) DB Reference

    Hi,

    i have this class

    Code:
    @Document(collection="fiche")
    public class Projet {
    	
    	//Id Projet Evalué
    	String idProjet;
    	
    	//Projet Evalué
    	String projetEvalue;
    	
    	//Service Gerant le Projet
    	String serviceProjet;
    	
    	//Date D'évaluation du projet
    	String dateEvaluation;
    	
    	@DBRef
    	private Client client;
    	
    	@DBRef
    	private Contexte contexte;
    	
    	@DBRef
    	private Collaborateur collaborateur;
    	
    	@DBRef
    	private Evaluateur evaluateur;
    
      //Getters and Setters


    When inserts documents i a collection
    Code:
    mongotemplate.insert(fiche);
    what is sotred in fiche ?? the wholes refenced classes or just classes ids

    Thanks

  2. #2
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    This depends on what fiche actually is (i guess an instance of Projet?). The document will contain all non-DbRef properties directly and native MongoDB DBRef objects [0] for the ones annotated with @DbRef. Find further information on DbRef usage in the reference documentation [1]. Also it might be worthwhile using the MongoDB shell to inspect the saved documents to get an impression of what this looks like exactly.

    [0] http://docs.mongodb.org/manual/appli...rences/#dbrefs
    [1] http://static.springsource.org/sprin...age-references

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •