コード例 #1
0
  @Test
  public void testPojoWithId() {

    ctx.setInitialEntitySet(Collections.singleton(PersonWithId.class));
    ctx.initialize();

    PersistentEntity<?, SampleProperty> person = ctx.getPersistentEntity(PersonWithId.class);
    assertNotNull(person.getIdProperty());
    assertEquals(String.class, person.getIdProperty().getType());
  }
コード例 #2
0
  @Test
  public void testAssociations() {

    ctx.setInitialEntitySet(Collections.singleton(PersonWithChildren.class));
    ctx.initialize();

    PersistentEntity<?, SampleProperty> person = ctx.getPersistentEntity(PersonWithChildren.class);
    person.doWithAssociations(
        new AssociationHandler<MappingMetadataTests.SampleProperty>() {
          public void doWithAssociation(Association<SampleProperty> association) {
            assertEquals(Child.class, association.getInverse().getComponentType());
          }
        });
  }