Announcement Announcement Module
Collapse
No announcement yet.
OdmManager update method - Implementation using LdapTemplate's rebind Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • OdmManager update method - Implementation using LdapTemplate's rebind

    I was looking for a fast way to map a java bean to an ldap entry and then I stumbled upon the ODM concept. It helped me to get a fast solution to my problem.

    However after some tests of the CRUD features I spotted an issue with the update operation: I had an user entry in my ldap, this user was also member of several groups, then I tried to update a field of that user using the OdmManager.update method, the result was that the field was updated as expected, but then I checked the user's group membership and to my surprise it had been deleted.

    From the OdmManager's update method default implementation (OdmManagerImpl.update) we can see:

    Code:
    public void update(Object entry) {
    		...
            DirContextAdapter context = new DirContextAdapter(getId(entry));
            mapToContext(entry, context);
            ldapTemplate.rebind(context);
    		
    }
    The problem with this implementation is the call to the LdapTemplate's rebind method; that call will cause the entry being deleted first before replacing it with a new entry containing the changes. This implementation detail explains the behavior I describe above.

    This behavior brings undesired side effects to the structure of other parts of the ldap. Wouldn't be better to implement the update method using LdapTemplate's modifyAttributes method?.

    Best regards

  • #2
    Buuu

    Buuuuuuuuuuuuuu

    Comment


    • #3
      Bump! I have the same problem. Does anyone have a solution to this?

      Comment


      • #4
        Exactly the same here!

        Furthermore, in Active Directory i can not handle directly the attribute "memberOf" (i can't map it into user entry), so the problem becomes blocking.

        Sadly, I belive that the only alternative for me is to return to LdapTemplate. : (

        Comment

        Working...
        X