Reading through MongoTemplate is seems like this is not just an issue with saveDBObject(). Looks like insertDBObjectList() is making incorrect assumptions about ObjectId.
This is a blocker issue for us in terms of adopting this project. I strongly recommend that a fix for this issue be included in 1.0.0.
This is discussed here: http://forum.springsource.org/showthread.php?t=104461. From this thread:
Thanks for the replies. I have spent some time looking at the code, especially MongoTemplate and see the way ObjectId is assumed in several places. However, it seems like a bad implementation decision and an easy thing to fix.
We are heavily invested in spring and have been using mongo for a while and were hoping to adopt the spring mongo integration asap. This looks like the only blocker.
We are using Jackson to serialize/deserialize java objects to/from JSON and the mongo java driver to go between JSON and DBObject. It is trivial to hook our Jackson infrastructure into MongoTemplate by implementing the MongoReaderWriter interface. We have already tried this out. This would allow us to keep using Jackson while the spring mongo project comes up with a useable serialization/deserialization mechanism.