cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Maptype attribute on User creates stream duplicate key exception in 1905

Former Member
0 Kudos
552

We added a localized string to Employee and ran into this problem:

It seems that at least in 1905 hybris uses servicelayer direct to persist the User items and the way that is implemented does not play well with maptypes.

In the core class DefaultAutitableSave.findBlacklistedAttributes it tries to add the items attribute values to a map by using streams.

As soon as more than one value is set in the maptype attribute this fails with a duplicate key error. (Java streams don't allow keys in map to be overwritten without specifying a merge function)

Am I missing something? I can't find any documentation about this.


Problem can be recreated like this:

<itemtype code="UserWithMapAttribute" extends="User" autocreate="true" generate="true">
 <attributes>
  <attribute qualifier="test" type="localized:java.lang.String">
   <persistence type="property"/>
  </attribute>
 </attributes>
</itemtype>

URS, then create an item of type UserWithMapAttribute and save. Now try to set a value on the test attribute in two different languages and save.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

User has the blacklisted field `encodedPassword` and the hybris code to handle blacklisted attributes is not capable of dealing with maptypes. Auditing can be turned off for the custom type by adding the type to the `auditing.blacklist` property. Thanks to Stefan Kruk!

Answers (0)