Nitrite/Java: NitriteId manual creation #37
-
Hello, I would like to create my self the nitriteId but it seems it is not possible. As far as I understood, it is not possible because the toString of the NitrideId is not a String representing the underlying long value. What I am trying to do is (1) annotating the NitriteId field of my object with @id; (2) creating manually the nitriteId for each on of my objects; (3) implementing the Mappable interface to transform the object in a document, and vice-versa; (4) put in the document the key "_id" with the value NitriteId. However, it fails in this if internal code: $if (DOC_ID.contentEquals(key) && !validId(value)) $ because inside the validId(value) method it gets the toString of the value, which in this case is the toString of an NitriteId object, and this does not return just the long value as a String. Is there a way that allows me to have the NitriteId directly as a @id while I am responsible for generating this id? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 6 replies
-
Hi @tmoliveira, you can capture the auto-generated |
Beta Was this translation helpful? Give feedback.
Hi @tmoliveira, you can capture the auto-generated
NitriteId
in your object by annotating the field with@Id
. But you cannot create your own nitrite id, as it's forbidden by design.