Entity classes managed by the OdmManager
are required
to be annotated with the annotations in the
org.springframework.ldap.odm.annotations
package. The
available annotations are:
@Entry
- Class level annotation indicating the
objectClass
definitions to which the entity
maps. (required)
@Id
- Indicates the entity DN; the field declaring
this attribute must be a derivative of the
javax.naming.Name
class.
(required)
@Attribute
- Indicates the mapping of a directory
attribute to the object class field.
@Transient
- Indicates the field is not persistent
and should be ignored by the OdmManager
.
The @Entry
and @Id
attributes are
required to be declared on managed classes. @Entry
is used to
specify which object classes the entity maps too. All object classes for
which fields are mapped are required to be declared. Also, in order for a
directory entry to be considered a match to the managed entity, all object
classes declared by the directory entry must match be declared by in the
@Entry
annotation.
The @Id
annotation is used to map the distinguished
name of the entry to a field. The field must be an instance of
javax.naming.Name
or a subclass of it.
The @Attribute
annotation is used to map object
class fields to entity fields. @Attribute
is required to
declare the name of the object class property to which the field maps and
may optionally declare the syntax OID of the LDAP attribute, to guarantee
exact matching. @Attribute
also provides the type declaration
which allows you to indicate whether the attribute is regarded as binary
based or string based by the LDAP JNDI provider.
The @Transient
annotation is used to indicate the
field should be ignored by the OdmManager
and not mapped to
an underlying LDAP property.