Beispiel #1
0
  @Test
  @Ignore("https://github.com/mongodb/morphia/issues/675")
  public void testReference() {
    getMorphia().map(CompoundIdEntity.class, CompoundId.class);
    getDs().getCollection(CompoundIdEntity.class).drop();

    final CompoundIdEntity sibling = new CompoundIdEntity();
    sibling.id = new CompoundId("sibling ID");
    getDs().save(sibling);

    final CompoundIdEntity entity = new CompoundIdEntity();
    entity.id = new CompoundId("entity ID");
    entity.e = "some value";
    entity.sibling = sibling;
    getDs().save(entity);

    final CompoundIdEntity loaded = getDs().get(entity);
    Assert.assertEquals(entity, loaded);
  }