Package com.github.jmkgreen.morphia.TestMapper

Examples of com.github.jmkgreen.morphia.TestMapper.UsesCustomIdObject


    public void testComplexIdQuery() throws Exception {
      CustomId cId = new CustomId();
      cId.id = new ObjectId();
      cId.type = "banker";

      UsesCustomIdObject ucio = new UsesCustomIdObject();
      ucio.id = cId;
      ucio.text = "hllo";
      this.ds.save(ucio);

      UsesCustomIdObject ucioLoaded = ds.find(UsesCustomIdObject.class, "_id.type", "banker").get();
        assertNotNull(ucioLoaded);
    }
View Full Code Here


    public void testComplexIdQueryWithRenamedField() throws Exception {
      CustomId cId = new CustomId();
      cId.id = new ObjectId();
      cId.type = "banker";

      UsesCustomIdObject ucio = new UsesCustomIdObject();
      ucio.id = cId;
      ucio.text = "hllo";
      this.ds.save(ucio);

      UsesCustomIdObject ucioLoaded = ds.find(UsesCustomIdObject.class, "_id.t", "banker").get();
        assertNotNull(ucioLoaded);
    }
View Full Code Here

    public void testQBE() throws Exception {
      CustomId cId = new CustomId();
      cId.id = new ObjectId();
      cId.type = "banker";

      UsesCustomIdObject ucio = new UsesCustomIdObject();
      ucio.id = cId;
      ucio.text = "hllo";
      this.ds.save(ucio);
      UsesCustomIdObject ucioLoaded  = null;

//    Add back if/when query by example for embedded fields is supported (require dot'n each field).
//      CustomId exId = new CustomId();
//      exId.type = cId.type;
//      ucioLoaded = ds.find(UsesCustomIdObject.class, "_id", exId).get();
//      assertNotNull(ucioLoaded);

      UsesCustomIdObject ex = new UsesCustomIdObject();
      ex.text = ucio.text;
      ucioLoaded = ds.queryByExample(ex).get();
        assertNotNull(ucioLoaded);
    }
View Full Code Here

TOP

Related Classes of com.github.jmkgreen.morphia.TestMapper.UsesCustomIdObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.