Applications and services can use the directory in different ways to store and locate objects:
Which of these three ways to use depends on the application/system that is being built and how it needs to interoperate with other applications and systems that will share the objects stored in the directory. Another factor is the support provided by the service provider and the underlying directory service.
Programmatically, all applications use one of the following methods when storing objects in the directory:
The application passes the object that it wants to store to one of these methods. Then, depending on the types of objects that the service provider supports, the object will be transformed into a representation acceptable to the underlying directory service.This lesson shows how to store serializable objects in the directory once the object is stored, you can simply use lookup() to get a copy of the object back from the directory, regardless of what type of information was actually stored.
You can get the object back not only by using lookup(), but also when you list a context and when you search a context or its subtree. In all of these cases, object factories might be involved. Object factories are discussed in detail in the JNDI Tutorial
For storing below objects types, please refer to the JNDI Tutorial
Windows Active Directory: Context.rebind() and DirContext.rebind() do not work against Active Directory because these methods work by reading the attributes of the entry to be updated, removing the entry, and then adding a new entry that contains the modified attributes. Active Directory returns some attributes that cannot be set by the user, causing the final addition step to fail. The workaround for this problem is to use DirContext.getAttributes() to obtain and save the attributes that you want to keep. Then, remove the entry and add it back with the saved attributes (and any others that you want to add) using DirContext.bind() .