Announcement Announcement Module
Collapse
No announcement yet.
Save dociuments using (@DBREF) DB Reference Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X