Skip to content

ArangoDB: use _key instead of _id #293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 8, 2024

Conversation

rashtao
Copy link
Contributor

@rashtao rashtao commented Nov 8, 2024

TODO: rebase onto #292 once merged


In ArangoDB, the field _key should be considered as primary key for the documents. In fact, _id field is read-only (the database ignores the values set by the client) and auto-generated by the database (concatenating <collection-name>/<_key>.

See https://docs.arangodb.com/stable/concepts/data-structure/documents/#document-keys

For the moment, I have annotated the id fields in the test entities specifying _key value, e.g.:

@Entity
public class Book {

    @Id("_key")
    private String id;

    // ...
} 

Ideally in future we could allow databases implementation specify the default field name, i.e. allowing:

@Entity
public class Book {

    @Id
    private String id;

    // ...
} 

to be mapped automatically to field _key when using ArangoDB.

@genie-jnosql
Copy link
Collaborator

Can one of the admins verify this patch?

@otaviojava otaviojava merged commit 1dc95c1 into eclipse-jnosql:main Nov 8, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants