Closed GoogleCodeExporter closed 9 years ago
Morphia 0.99 Driver 2.6.3 Mongo 1.8.2 UUID map keys are converted to string when writing, but not back to uuids when reading. A simple converter seems to fix this. public class UUIDConverter extends TypeConverter implements SimpleValueConverter { public UUIDConverter() { super(UUID.class); } public Object encode(Object value, MappedField optionalExtraInfo) { UUID uuid = (UUID) value; if (uuid == null) { return null; } return uuid.toString(); } public Object decode(Class targetClass, Object fromDBObject, MappedField optionalExtraInfo) throws MappingException { String object = (String) fromDBObject; return object == null ? null : UUID.fromString(object); } }
Original issue reported on code.google.com by stu...@googlemail.com on 5 Sep 2011 at 9:26
stu...@googlemail.com
This issue was closed by revision r1788.
Original comment by scotthernandez on 19 Nov 2011 at 2:59
scotthernandez
Original issue reported on code.google.com by
stu...@googlemail.com
on 5 Sep 2011 at 9:26