* @param metaclass The class for which the mapping applies.
* @return The loaded persistence mapping object.
*/
public PersistenceMapping loadPersistenceMapping(Element element, Metaclass metaclass)
{
PersistenceMapping mapping = loadPersistenceMappingDetails(element, metaclass);
String sLockingAttribute = XMLUtil.getStringAttr(element, "lockingAttribute");
if (sLockingAttribute != null)
{
mapping.setLockingAttribute(metaclass.getAttribute(sLockingAttribute));
}
String sTypeCodeAttribute = XMLUtil.getStringAttr(element, "classCodeAttribute");
if (sTypeCodeAttribute != null)
{
mapping.setTypeCodeAttribute(metaclass.getAttribute(sTypeCodeAttribute));
}
mapping.setTypeCodeForced(XMLUtil.getBooleanAttr(element, "classCodeForced", false));
String sFragmentAttribute = XMLUtil.getStringAttr(element, "fragmentAttribute");
if (sFragmentAttribute != null)
{
mapping.setFragmentAttribute(metaclass.getAttribute(sFragmentAttribute));
}
String sFragmentReplication = XMLUtil.getStringAttr(element, "fragmentReplication");
if (sFragmentReplication != null)
{
if (sFragmentReplication.equals("unicast"))
{
mapping.setFragmentReplication(PersistenceMapping.REPLICATION_UNICAST);
}
else if (sFragmentReplication.equals("broadcast"))
{
mapping.setFragmentReplication(PersistenceMapping.REPLICATION_BROADCAST);
}
else
{
throw new MetadataException("err.meta.fragmentReplication",
new Object[]{sFragmentReplication, metaclass.getName()});
}
}
String sCaching = XMLUtil.getStringAttr(element, "caching");
if (sCaching != null)
{
if (sCaching.equals("instance"))
{
mapping.setCaching(PersistenceMapping.CACHING_INSTANCE);
}
else if (sCaching.equals("class"))
{
mapping.setCaching(PersistenceMapping.CACHING_CLASS);
}
else
{
throw new MetadataException("err.meta.caching",
new Object[]{sCaching, metaclass.getName()});