public void testMorphToElementCollectionMapping() throws Exception {
    createTestEntityWithIdMapping();
    addXmlClassRef(FULLY_QUALIFIED_TYPE_NAME);

    SpecifiedPersistentAttribute persistentAttribute =
        getJavaPersistentType().getAttributes().iterator().next();
    IdMapping idMapping = (IdMapping) persistentAttribute.getMapping();
    JavaResourceType resourceType =
        (JavaResourceType)
            getJpaProject().getJavaResourceType(FULLY_QUALIFIED_TYPE_NAME, AstNodeType.TYPE);
    JavaResourceField resourceField = resourceType.getFields().iterator().next();
    assertFalse(idMapping.isDefault());
    idMapping.getColumn().setSpecifiedName("FOO");
    idMapping.setConverter(BaseTemporalConverter.class);
    ((BaseTemporalConverter) idMapping.getConverter()).setTemporalType(TemporalType.TIME);
    idMapping.addGeneratedValue();
    idMapping.getGeneratorContainer().addTableGenerator();
    idMapping.getGeneratorContainer().addSequenceGenerator();
    resourceField.addAnnotation(AccessAnnotation2_0.ANNOTATION_NAME);
    assertFalse(idMapping.isDefault());

    persistentAttribute.setMappingKey(MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY);
    assertTrue(persistentAttribute.getMapping() instanceof ElementCollectionMapping2_0);

    assertNull(resourceField.getAnnotation(IdAnnotation.ANNOTATION_NAME));
    assertNotNull(resourceField.getAnnotation(ElementCollectionAnnotation2_0.ANNOTATION_NAME));
    assertNotNull(resourceField.getAnnotation(AccessAnnotation2_0.ANNOTATION_NAME));
    assertNotNull(resourceField.getAnnotation(ColumnAnnotation.ANNOTATION_NAME));
    assertNotNull(resourceField.getAnnotation(TemporalAnnotation.ANNOTATION_NAME));
    assertNull(resourceField.getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME));
    assertNull(resourceField.getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME));
    assertNull(resourceField.getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME));
  }
 protected String getTargetEntityIdAttributeName() {
   SpecifiedPersistentAttribute attribute = this.getTargetEntityIdAttribute();
   return (attribute == null) ? null : attribute.getName();
 }