AbstractMapStoreSpecialization specialization)
{
super(storeMgr, specialization);
this.clr = clr;
setOwner(fmd, clr);
MapMetaData mmd = (MapMetaData)fmd.getContainer();
if (mmd == null)
{
// No <map> specified for this field!
throw new NucleusUserException(LOCALISER.msg("056002", fmd.getFullFieldName()));
}
// Check whether we store the key in the value, or the value in the key
boolean keyStoredInValue = false;
if (fmd.getKeyMetaData() != null && fmd.getKeyMetaData().getMappedBy() != null)
{
keyStoredInValue = true;
}
else if (fmd.getValueMetaData() != null && fmd.getValueMetaData().getMappedBy() == null)
{
// No mapped-by specified on either key or value so we dont know what to do with this relation!
throw new NucleusUserException(LOCALISER.msg("056071", fmd.getFullFieldName()));
}
else
{
// Should throw an exception since must store key in value or value in key
}
// Load the key and value classes
keyType = mmd.getKeyType();
valueType = mmd.getValueType();
Class keyClass = clr.classForName(keyType);
Class valueClass = clr.classForName(valueType);
ApiAdapter api = getStoreManager().getApiAdapter();
if (keyStoredInValue && !api.isPersistable(valueClass))