Closed
Description
Allan Chiou opened DATAMONGO-1058 and commented
When transitioning from 1.4.3.RELEASE to 1.6.0.RELEASE, the model below no longer returns with map
Model
@Document(collection="model")
class Model {
@Id
ObjectId id;
/**
* Currently only works without @Field annotation
*/
@Field("foo")
@DBRef
Map<String, Foo> mapOfFoos ; //assume Foo is a class
}
Repo
public interface ModelDao extends MongoRepository<Model, ObjectId> {
}
public interface FooDao extends MongoRepository<Foo, ObjectId> {
}
Snippet of a unit test
...
Model model = new Model();
Map<String, Foo> mapOfFoos = new HashMap<String, Foo>();
Foo foo = new Foo()
fooDao.save(foo)
mapOfFoo("somestring", foo)
model.setMapOfFoos(mapOfFoo)
modelDao.save(model);
Model retreivedModel = modelDao.findOne(model.getId());
//retreivedModel.getMapOfFoos() returns null
//EXPECTED (and previous behavior) retreivedModel.getMapOfFoos() not null
Affects: 1.6 GA (Evans)
Reference URL: http://stackoverflow.com/questions/25971669/springdata-mongodb-field-sometime-works-sometime-not
Referenced from: pull request #227
Backported to: 1.6.1 (Evans SR1), 1.5.5 (Dijkstra SR5)
1 votes, 3 watchers