cancel
Showing results for 
Search instead for 
Did you mean: 

MDM Exception: Key mapping value must be unique. You cannot overwrite key

Former Member
0 Kudos

"ServerException: Key mapping value must be unique. You cannot overwrite key mapping values."

I received such exception when code tried to manipulate Key Mappings of the record.

error was not happen on mdm 5.5 but on 7.1 it sometimes appears.

What is probable reason of this?

How to resolve this ?

Code is approximate so:

		
                                     String[] keys = keyMapping.getKeys();
	               if (recordKeyMapping.containsKeyMapping(remoteSystem)) {
	    	  recordKeyMapping.replace(remoteSystem, keys);
		}
		else {
			recordKeyMapping.addKeyMapping(keyMapping);

		//Persist
		targetRecord.update();

//where methods are:

	public void replace(RemoteSystem remoteSystem, String[] keys) {
		KeyMapping keyMapping = getKeyMapping(remoteSystem);
		if (keyMapping == null) throw new IllegalArgumentException("Can't update keys: key mapping for the system '" + remoteSystem + "' is not found");
		else {
			keyMapping.setKeys(keys);
		}
	}

	public void addKeyMapping(KeyMapping keyMapping) {
		RemoteSystem remoteSystem = keyMapping.getRemoteSystem();
		for(int i = 0; i < keyMapping.size(); i++) {
			addKey(remoteSystem, (String) keyMapping.get(i));
		}
	}

Edited by: Vladimir Grigoryev on Oct 5, 2010 11:26 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member208981
Contributor
0 Kudos

Hi Vladimir,

The error occurs when there is already a record which has a key say "ABC", and the new record that you are creating is also trying to have the same remote key. Please check whay is mapped to remote key in import manager.

Thanks,

Priti

former_member182007
Active Contributor
0 Kudos

Hello -

I am not sure on that coding part. but is it like are you trying to retrive Key Mapping from Memory accelerator. Here this information always needs to be read from Database.

I am sure you also maintained the required attribute for key mapping as in Property in Console should be set as "Yes" and other relevant things properly .

Here also go through the below link for more insight from tools perspective.

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30843106-5539-2b10-75a9-da483911b...

http://help.sap.com/javadocs/mdm/sp06/com/sap/mdm/data/KeyMapping.html

It may help

Rgds

Deep