title: Spring-Data for MongoDB exception while using @DBRef annotation for referencing
body: <p>Here I am trying with @DBRef annotation for referencing object from another one in Spring-Data for MongoDB. But after running MongoApp class, result table data is getting inserted in DB but its showing no method found exception for Person object insert, like in following example. Whats happening here?</p>
  
  <pre><code>public class Result {
  
    @Id
    @NotNull
    private String subjectId;
  
    @NotNull
    private String subName;
  
    @NotNull
    @Max(value = 100)
    private int marks;
  
    public Result(String subjectId, String subName, int marks) {
      this.subjectId = subjectId;
      this.subName = subName;
      this.marks = marks;
    }
  }
  
  public class Person {
  
  
        @Id
        @NotNull
        private String abc;
  
        @NotNull
        @Size(max = 8, min = 4, message = "Not a Valid Name")
        private String name;
  
        @Max(value = 100)
        private int age;
  
        @DBRef(collection = "result")
        private Result result;
  
        public Person(String id, String name, int age, Result result) {
          this.abc = id;
          this.name = name;
          this.age = age;
          this.result = result;
        }
  }
  
  public static void main(String[] args) throws Exception{
    String location = "com/springMongo/core/applicationContext-springdata.xml";
    ApplicationContext context = new ClassPathXmlApplicationContext(location);
    MongoOperations mongoOps = (MongoOperations) context.getBean("mongoTemplate");
    mongoOps.insert(new Result("1","Math",50));
  
    Query query = new Query(Criteria.where("subjectId").is("1"));
    mongoOps.insert(new Person("1212", "Ravi", 34, mongoOps.findOne(query, Result.class)));
  }
  </code></pre>
  
  <p>After Running above application its Showing following exception</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.mapping.MongoPersistentProperty.isCollection()Z
  at org.springframework.data.mongodb.core.convert.MappingMongoConverter.writePropertyInternal(MappingMongoConverter.java:448)
  at org.springframework.data.mongodb.core.convert.MappingMongoConverter$5.doWithAssociation(MappingMongoConverter.java:433)
  at org.springframework.data.mapping.model.BasicPersistentEntity.doWithAssociations(BasicPersistentEntity.java:185)
  at org.springframework.data.mongodb.core.convert.MappingMongoConverter.writeInternal(MappingMongoConverter.java:420)
  at org.springframework.data.mongodb.core.convert.MappingMongoConverter.writeInternal(MappingMongoConverter.java:351)
  at org.springframework.data.mongodb.core.convert.MappingMongoConverter.write(MappingMongoConverter.java:316)
  at org.springframework.data.mongodb.core.convert.MappingMongoConverter.write(MappingMongoConverter.java:77)
  at org.springframework.data.mongodb.core.MongoTemplate.doInsert(MongoTemplate.java:592)
  at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:554)
  at org.springframework.data.mongodb.core.MongoTemplate.insert(MongoTemplate.java:545)
  at com.springMongo.core.MongoApp.main(MongoApp.java:43)
  </code></pre>