Descubrí que no es posible agregar un nuevo private final
campo a una colección existente usando solo el @PersistenceContstructor
anotación. En su lugar, necesitaba agregar un org.springframework.core.convert.converter.Converter
implementación para manejar la lógica por mí.
Así es como quedó mi convertidor:
@ReadingConverter
public class SnapshotReadingConverter implements Converter<DBObject, Snapshot> {
@Override
public Snapshot convert(DBObject source) {
long id = (Long) source.get("_id");
String description = (String) source.get("description");
boolean active = (Boolean) source.get("active");
boolean billable = false;
if (source.get("billable") != null) {
billable = (Boolean) source.get("billable");
}
return new Snapshot(id, description, active, billable);
}
}
Espero que esto pueda ayudar a alguien más en el futuro.