public void testJoinFetchDefaultFromJava() throws Exception {
    createTestEmployee();
    createTestDepartment();
    getEntityMappings()
        .addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Department");
    getEntityMappings()
        .addPersistentType(MappingKeys.ENTITY_TYPE_MAPPING_KEY, PACKAGE_NAME + ".Employee");

    OrmPersistentType departmentPersistentType =
        getEntityMappings().getPersistentTypes().iterator().next();
    EclipseLinkOneToOneMapping oneToOne =
        (EclipseLinkOneToOneMapping)
            departmentPersistentType.getAttributeNamed("employee").getMapping();

    assertNull(oneToOne.getJoinFetch().getValue());

    getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(true);
    oneToOne =
        (EclipseLinkOneToOneMapping)
            departmentPersistentType.getAttributeNamed("employee").getMapping();
    assertNull(oneToOne.getJoinFetch().getValue());

    EclipseLinkRelationshipMapping javaRelationshipMapping =
        (EclipseLinkRelationshipMapping)
            departmentPersistentType
                .getJavaPersistentType()
                .getAttributeNamed("employee")
                .getMapping();
    javaRelationshipMapping.getJoinFetch().setValue(EclipseLinkJoinFetchType.OUTER);
    assertNull(oneToOne.getJoinFetch().getValue());

    getEntityMappings().getPersistenceUnitMetadata().setXmlMappingMetadataComplete(false);
    oneToOne =
        (EclipseLinkOneToOneMapping)
            departmentPersistentType.getAttributeNamed("employee").getMapping();
    assertEquals(EclipseLinkJoinFetchType.OUTER, oneToOne.getJoinFetch().getValue());
  }