You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/asciidoc/index.adoc
+17-8Lines changed: 17 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1073,19 +1073,28 @@ For example, assume that you have entries in your LDAP tree that have the follow
1073
1073
If you are interested only in changing the attributes defined in the `person` object class, you can annotate your `@Entry` with `@Entry(objectClasses = { "person", "top" })`.
1074
1074
However, if you want to manage attributes defined in the `inetOrgPerson` objectclass, you need to use the following: `@Entry(objectClasses = { "inetOrgPerson", "organizationalPerson", "person", "top" })`.
1075
1075
1076
-
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`.
1076
+
All entity fields are mapped by their field name to LDAP attributes. The remaining annotations -- `@Id`, `@Attribute`, `@Transient`, and `@DnAttribute` -- affect how that mapping occurs.
1077
1077
1078
-
The `@Attribute` annotation is used to map object class fields to entity fields.
1079
-
`@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.
1080
-
`@Attribute` also provides the type declaration, which lets you indicate whether the attribute is regarded as binary-based or string-based by the LDAP JNDI provider.
1078
+
First, the `@Id` annotation maps the distinguished name of the entry to a field. The field must be an instance of `javax.naming.Name`.
1081
1079
1082
-
The `@DnAttribute` annotation is used to map object class fields to and from components in the distinguished name of an entry.
1083
-
Fields annotated with `@DnAttribute` are automatically populated with the appropriate value from the distinguished name when an entry is read from the directory tree.
1080
+
Second, the `@Attribute` annotation maps entity fields to LDAP attributes.
1081
+
This is handy when the attribute name is different from the field name.
1082
+
To use `@Attribute`, you must declare the name of the attribute to which the field maps.
1083
+
Optionally, you can also guarantee and exact match by including the syntax OID of the LDAP attribute.
1084
+
Finally, `@Attribute` also provides the type declaration, which lets you indicate whether the attribute is regarded as binary- or string-based by the LDAP JNDI provider.
1085
+
1086
+
Third, the `@Transient` annotation indicates that the given entity field does not map to an LDAP attribute.
1087
+
1088
+
Finally, the `@DnAttribute` annotation additionally maps entity fields to components of an entry's distinguished name.
1084
1089
Only fields of type `String` can be annotated with `@DnAttribute`. Other types are not supported.
1085
-
If the `index` attribute of all `@DnAttribute` annotations in a class is specified, the DN can also be automatically calculated when creating and updating entries.
1090
+
1091
+
[TIP]
1092
+
When the `index` attribute of all `@DnAttribute` annotations in a class is specified, the DN can also be automatically calculated when creating and updating entries.
1086
1093
For update scenarios, this also automatically takes care of moving entries in the tree if attributes that are part of the distinguished name have changed.
1087
1094
1088
-
The `@Transient` annotation indicates that the field should be ignored by the object directory mapping and not mapped to an underlying LDAP property. Note that if a `@DnAttribute` is not to be bound to an `Attribute`. That is, it is only part of the Distinguished Name and not represented by an object attribute. It must also be annotated with `@Transient`.
1095
+
[NOTE]
1096
+
Remember that all fields are mapped to LDAP attributes by default.
1097
+
`@DnAttribute` does not change this; in other words, fields annotated with `@DnAttribute` will also map to an LDAP attribute, unless you also annotate the field with `@Transient`.
0 commit comments