public void testGetPersistenceMapping()
{
assertNotNull(m_contact.getPersistenceMapping());
RelationalMapping hrRequestMapping = (RelationalMapping)m_hrRequest.getPersistenceMapping();
assertNotNull(hrRequestMapping);
assertNotNull(hrRequestMapping.getLockingAttribute());
assertEquals("version", hrRequestMapping.getLockingAttribute().getName());
RelationalPrimitiveMapping versionMapping =
(RelationalPrimitiveMapping)hrRequestMapping.getAttributeMapping(m_hrRequest.getAttribute("version"));
assertNotNull(versionMapping);
assertEquals("version", versionMapping.getColumn().getName());
assertEquals("test.HRRequest", versionMapping.getColumn().getTable().getName());
RelationalMapping principalRefMapping = (RelationalMapping)m_principalRef.getPersistenceMapping();
assertNotNull(principalRefMapping);
assertNotNull(principalRefMapping.getLockingAttribute());
assertEquals("version", principalRefMapping.getLockingAttribute().getName());
versionMapping = (RelationalPrimitiveMapping)principalRefMapping
.getAttributeMapping(m_principalRef.getAttribute("version"));
assertNotNull(versionMapping);
assertEquals("version", versionMapping.getColumn().getName());
assertEquals("PrincipalRef", versionMapping.getColumn().getTable().getName());
RelationalClassMapping principalMapping = (RelationalClassMapping)principalRefMapping
.getAttributeMapping(m_principalRef.getAttribute("principal"));
assertNotNull(principalMapping);
assertEquals("PrincipalRef.FK_Usr", principalMapping.getSourceKey().getName());
assertEquals("Usr.PK", ((Index)principalMapping.getDestinationKey()).getName());
assertEquals(1, principalMapping.getDenormCount());
assertEquals("PrincipalExt.FK_Usr", ((RelationalClassDenorm)principalMapping.getDenorm(0)).getSourceKey().getName());
principalMapping = (RelationalClassMapping)principalRefMapping
.getAttributeMapping(m_principalRef.getAttribute("principal2"));
assertNotNull(principalMapping);
assertEquals("PrincipalRef.PK", principalMapping.getSourceKey().getName());
assertEquals("Usr.PK", ((Index)principalMapping.getDestinationKey()).getName());
assertEquals(0, principalMapping.getDenormCount());
RelationalPrimitiveMapping principalIdMapping = (RelationalPrimitiveMapping)principalRefMapping
.getAttributeMapping(m_principalRef.getAttribute("principalId"));
assertNotNull(principalIdMapping);
assertEquals("principalId", principalIdMapping.getColumn().getName());
assertEquals("PrincipalRef", principalIdMapping.getColumn().getTable().getName());