persistenceUnitMetadataMapping.setSetMethodName("setPersistenceUnitMetadata");
persistenceUnitMetadataMapping.setReferenceClass(XMLPersistenceUnitMetadata.class);
persistenceUnitMetadataMapping.setXPath("orm:persistence-unit-metadata");
descriptor.addMapping(persistenceUnitMetadataMapping);
XMLDirectMapping packageMapping = new XMLDirectMapping();
packageMapping.setAttributeName("m_package");
packageMapping.setGetMethodName("getPackage");
packageMapping.setSetMethodName("setPackage");
packageMapping.setXPath("orm:package/text()");
descriptor.addMapping(packageMapping);
descriptor.addMapping(getSchemaMapping());
descriptor.addMapping(getCatalogMapping());
descriptor.addMapping(getAccessMapping());
descriptor.addMapping(getConverterMapping());
descriptor.addMapping(getTypeConverterMapping());
descriptor.addMapping(getObjectTypeConverterMapping());
descriptor.addMapping(getStructConverterMapping());
XMLCompositeCollectionMapping sequenceGeneratorsMapping = new XMLCompositeCollectionMapping();
sequenceGeneratorsMapping.setAttributeName("m_sequenceGenerators");
sequenceGeneratorsMapping.setGetMethodName("getSequenceGenerators");
sequenceGeneratorsMapping.setSetMethodName("setSequenceGenerators");
sequenceGeneratorsMapping.setReferenceClass(SequenceGeneratorMetadata.class);
sequenceGeneratorsMapping.setXPath("orm:sequence-generator");
descriptor.addMapping(sequenceGeneratorsMapping);
XMLCompositeCollectionMapping tableGeneratorsMapping = new XMLCompositeCollectionMapping();
tableGeneratorsMapping.setAttributeName("m_tableGenerators");
tableGeneratorsMapping.setGetMethodName("getTableGenerators");
tableGeneratorsMapping.setSetMethodName("setTableGenerators");
tableGeneratorsMapping.setReferenceClass(TableGeneratorMetadata.class);
tableGeneratorsMapping.setXPath("orm:table-generator");
descriptor.addMapping(tableGeneratorsMapping);
descriptor.addMapping(getNamedQueryMapping());
descriptor.addMapping(getNamedNativeQueryMapping());
descriptor.addMapping(getNamedStoredProcedureQueryMapping());
descriptor.addMapping(getResultSetMappingMapping());
XMLCompositeCollectionMapping mappedSuperclassMapping = new XMLCompositeCollectionMapping();
mappedSuperclassMapping.setAttributeName("m_mappedSuperclasses");
mappedSuperclassMapping.setGetMethodName("getMappedSuperclasses");
mappedSuperclassMapping.setSetMethodName("setMappedSuperclasses");
mappedSuperclassMapping.setReferenceClass(MappedSuperclassAccessor.class);
mappedSuperclassMapping.setXPath("orm:mapped-superclass");
descriptor.addMapping(mappedSuperclassMapping);
XMLCompositeCollectionMapping entityMapping = new XMLCompositeCollectionMapping();
entityMapping.setAttributeName("m_entities");
entityMapping.setGetMethodName("getEntities");
entityMapping.setSetMethodName("setEntities");
entityMapping.setReferenceClass(EntityAccessor.class);
entityMapping.setXPath("orm:entity");
descriptor.addMapping(entityMapping);
XMLCompositeCollectionMapping embeddableMapping = new XMLCompositeCollectionMapping();
embeddableMapping.setAttributeName("m_embeddables");
embeddableMapping.setGetMethodName("getEmbeddables");
embeddableMapping.setSetMethodName("setEmbeddables");
embeddableMapping.setReferenceClass(EmbeddableAccessor.class);
embeddableMapping.setXPath("orm:embeddable");
descriptor.addMapping(embeddableMapping);
// What about the version attribute???
XMLDirectMapping versionMapping = new XMLDirectMapping();
versionMapping.setAttributeName("m_version");
versionMapping.setGetMethodName("getVersion");
versionMapping.setSetMethodName("setVersion");
versionMapping.setXPath("@version");
descriptor.addMapping(versionMapping);
return descriptor;
}