@@ -0,0 +1,933 @@
+package com.google.code.morphia.query;%0A%0A%0Aimport org.bson.types.ObjectId;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport com.google.code.morphia.TestBase;%0Aimport com.google.code.morphia.annotations.Entity;%0Aimport com.google.code.morphia.annotations.Id;%0A%0A%0Apublic class SortByIdTest extends TestBase %7B%0A%0A    @Entity(%22A%22)%0A    static class A %7B%0A        @Id%0A        ObjectId id;%0A        String name;%0A%0A        public A(final String name)%7B%0A            this.name=name;%0A        %7D%0A        public A()%7B%7D%0A    %7D%0A%0A    @Test%0A    public void getLastByIdTest()%7B%0A        final A a1 = new A(%22a1%22);%0A        final A a2 = new A(%22a2%22);%0A        final A a3 = new A(%22a3%22);%0A%0A        ds.save(a1);%0A        ds.save(a2);%0A        ds.save(a3);%0A%0A        Assert.assertEquals(%22last id%22, a3.id, ds.createQuery(A.class).order(%22-id%22).get().id);%0A        Assert.assertEquals(%22last id%22, a3.id, ds.createQuery(A.class).disableValidation().order(%22-_id%22).get().id);%0A    %7D%0A%0A%7D

test that invalidates #475