Announcement Announcement Module
Collapse
No announcement yet.
Set @DBREF FIELD Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Comment


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

      Comment

      Working...
      X