public void testUpdateSpecifiedCatalog() throws Exception {
    createTestEntityWithElementCollection();
    addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);

    JavaElementCollectionMapping2_0 elementCollectionMapping =
        (JavaElementCollectionMapping2_0)
            getJavaPersistentType().getAttributes().iterator().next().getMapping();
    CollectionTable2_0 collectionTable = elementCollectionMapping.getCollectionTable();

    JavaResourceType resourceType =
        (JavaResourceType)
            getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, AstNodeType.TYPE);
    JavaResourceField resourceField = resourceType.getFields().iterator().next();

    CollectionTableAnnotation2_0 resourceCollectionTable =
        (CollectionTableAnnotation2_0)
            resourceField.getAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME);

    assertNull(collectionTable.getSpecifiedCatalog());
    assertNull(resourceCollectionTable);

    // set catalog in the resource model, verify context model updated
    resourceField.addAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME);
    resourceCollectionTable =
        (CollectionTableAnnotation2_0)
            resourceField.getAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME);
    resourceCollectionTable.setCatalog("FOO");
    getJpaProject().synchronizeContextModel();
    assertEquals("FOO", collectionTable.getSpecifiedCatalog());
    assertEquals("FOO", resourceCollectionTable.getCatalog());

    // set catalog to null in the resource model
    resourceCollectionTable.setCatalog(null);
    getJpaProject().synchronizeContextModel();
    assertNull(collectionTable.getSpecifiedCatalog());
    assertNull(resourceCollectionTable.getCatalog());

    resourceCollectionTable.setCatalog("FOO");
    getJpaProject().synchronizeContextModel();
    assertEquals("FOO", collectionTable.getSpecifiedCatalog());
    assertEquals("FOO", resourceCollectionTable.getCatalog());

    resourceField.removeAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME);
    getJpaProject().synchronizeContextModel();
    assertNull(collectionTable.getSpecifiedCatalog());
    assertNull(resourceField.getAnnotation(CollectionTableAnnotation2_0.ANNOTATION_NAME));
  }