How to Map Java Pojo with parent and child class to LDAP using spring ldap

228 Views Asked by At

I am trying to map my java pojo (Parent and child classes) with LDAP entry using spring ODM @Entry as below

The ldap entry looks as below

enter image description here

//child class
public class ChildClass extends ParentClass{
   
   // attribute names are same as in LDAP
    protected String attribute1;
    protected String attribute2;
}


//parent class
import org.springframework.ldap.odm.annotations.Entry;
import org.springframework.ldap.odm.annotations.Id;

@Entry(objectClasses = {"testObjectClass"})
public class ParentClass {

    @Id
    Name dn;
    protected String cn;
    protected List<String> objectClass;
    
   // attribute names are same as in LDAP
    protected String attribute3;
    protected String attribute4;
    protected String attribute5;
}

Using Spring ldaptemplate i am trying to search as below.
ParentClass attributes value are getting populated properly, But ChildClass atributes value are populating as null.

List<ParentClass> results = ldapTemplate.find(dn, filter, searchControls, ParentClass.class)
0

There are 0 best solutions below