Create an Entity
An Entity
can use almost any Java data type. However, there are can be some special cases which are not possible.
E.g. The standard PojoCodec of mongodb only allows String
as keys in Map
. This was using a Custom MapCodec. In the references on github you can find all links which helped immensely.
If you found one any other incompatible data type, let me know and I'll implement it.
Requirements for entities
All entities must fulfil the following properties
Only one constructor, which is
public
and has no arguments, is existingThere is exactly 1 field with the
@Id
annotation to define the unique identifier.All fields are not
final
!
Except for the properties above, the entity can be adapted dynamically.
Example entity Customer
:
ATTENTION: There are also some Annotations from the MongoDB driver, but en2do doesn't support them. Please only use the Annotations from en2do directly!
Last updated