Database Reference
In-Depth Information
Properties
Within a class annotated with @NodeEntity , SDN will by default treat all simple fields
as being representative of Neo4j properties on the backing node. In this context, simple
means
• Any primitive or its associated wrapper class
• A string
• An object capable of being converted to a string through a Spring conversion ser-
vice
Collections of any of these types are also included, where these collections are ultimately
stored as an array on the Neo4j node. In the preceding domain example, this means that
the name and title fields defined on the User and Movie classes, respectively,
will get mapped as Neo4j properties with those same names, without you needing to lift a
finger!
What about custom property types?
The core Spring framework comes with a general type-conversion system that allows you
to write and register custom type-conversion logic that can transform a specific (nonprim-
itive) class to a string representation and back again. SDN has already registered some
conversion services for you that handle enums and dates. So if, for example, you define a
java.util.Date field on a node entity when the entity is due to get persisted, Spring
recognizes that there is a custom converter defined for date fields and uses it to convert the
Date property to a string that's then stored in the graph; the reverse occurs when reading
the data out of the graph and back into the node entity field.
Search WWH ::




Custom Search