Announcement Announcement Module
Collapse
No announcement yet.
Spring Data mongodb RC1 bug: can not update Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Data mongodb RC1 bug: can not update

    Hi

    Today i upgraded springdata mongodb from 1.0.0.M5 to 1.0.0.RC1, one of my class can not be updated anymore and get exception
    java.lang.RuntimeException: json can't serialize type : class com.klip.queue.db.model.FacebookAppRequestInfo
    at com.mongodb.util.JSON.serialize(JSON.java:261)
    at com.mongodb.util.JSON.serialize(JSON.java:210)
    at com.mongodb.util.JSON.serialize(JSON.java:141)
    at com.mongodb.util.JSON.serialize(JSON.java:141)
    at com.mongodb.util.JSON.serialize(JSON.java:58)
    at com.mongodb.BasicDBObject.toString(BasicDBObject.j ava:84)
    at java.lang.String.valueOf(String.java:2826)
    at java.lang.StringBuilder.append(StringBuilder.java: 115)
    at org.springframework.data.mongodb.core.MongoTemplat e$12.doInCollection(MongoTemplate.java:822)
    at org.springframework.data.mongodb.core.MongoTemplat e$12.doInCollection(MongoTemplate.java:808)
    at org.springframework.data.mongodb.core.MongoTemplat e.execute(MongoTemplate.java:368)
    at org.springframework.data.mongodb.core.MongoTemplat e.doUpdate(MongoTemplate.java:808)
    at org.springframework.data.mongodb.core.MongoTemplat e.updateFirst(MongoTemplate.java:790)


    After some debugging, i found the cause is that in RC1:
    MongoSimpleTypes includes DBObject as simple type somehow(simpleTypes.add(DBObject.class); line 51)

    when Mongotemplate is calling updateFirst and doing updateObj conversion: mongoConverter.convertToMongoType(updateObj.get(ke y)), each updateObj's value is basicDBObject, it is treated as simple type and no conversion process anymore, so embeded java pojo is not converted into BSON.

    MongoTemplate: line 815-819
    DBObject updateObj = update.getUpdateObject();

    for (String key : updateObj.keySet()) {
    updateObj.put(key, mongoConverter.convertToMongoType(updateObj.get(ke y)));
    }


    Any one can take a look and fix this issue?

    thanks

    eric
Working...
X