Results 1 to 3 of 3

Thread: Set @DBREF FIELD

  1. #1
    Join Date
    Mar 2013
    Posts
    20

    Default Set @DBREF FIELD

    hi please

    i have this reference
    Code:
    	
    @DBRef
    private Collaborateur collaborateur;
    between two classes

    my question is

    does this setter
    Code:
    public void setCollaborateur(Collaborateur collaborateur) {
    		this.collaborateur = collaborateur;
    	}
    in referencing class Sets $Id, $ref, $db fields of @DBREF collaborateur using the ones sets in collaborateur POJO?

    Code:
    @Document(collection="user")
    public class Collaborateur {
    	
    	@Id
        private String id;
    
        private String nomCollaborateur;
     
    
        private String prenomCollaborateur;
        
        
        
        private String loginCollaborateur;
        private String passwordCollaborateur;
        private String[] droitsCollaborateur;
    
    }
    if yes how can i get(read) those($Id, $ref, $db) values ??

    If no what does it sets

    Thanks for answer

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

    Default

    The entire DBRef mapping is not visible to the object nor should it be? The information is purely written on persisting the object and the object is re-materialized on read. You can peek into the raw document by using MongoTemplate and calling findOne(…) providing DBObject as target type and manually defining the collection to read from. This reads the raw document as is.

  3. #3
    Join Date
    Mar 2013
    Posts
    20

    Default

    Quote Originally Posted by Oliver Gierke View Post
    The entire DBRef mapping is not visible to the object nor should it be? The information is purely written on persisting the object and the object is re-materialized on read. You can peek into the raw document by using MongoTemplate and calling findOne(…) providing DBObject as target type and manually defining the collection to read from. This reads the raw document as is.
    Thannks

    I Noticed it when storing datas into my referencing class collection's

    thanks Once More

Posting Permissions

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