Skip to content
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

complex entities #19

Closed
piniSolomon opened this issue Dec 11, 2023 · 3 comments
Closed

complex entities #19

piniSolomon opened this issue Dec 11, 2023 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@piniSolomon
Copy link

Hi,
I'm new to the objectbox DB and I want to define the first entity to store in the database, I want to create an entity that one of the members is another entity


@Entity(id=3, uid=3)
class Engine:
    id=Id(id=1, uid=1005)
    model= Property(str, id=2, uid=1002)
    


@Entity(id=2, uid=2)
class Car:
    id=Id(id=1, uid=1001)
    name= Property(str, id=2, uid=1003)
    engine=Property(Engine, id=3, uid=1004)

I would like to create and save the car entity with the engine members.

Is it possible?

on the same logic I would like to create entities with inheritance

@greenrobot-team
Copy link
Member

greenrobot-team commented Dec 12, 2023

This would be done using the relations feature. But according to the README, it is not available for the Python library, yet.

Also see #7

@greenrobot-team greenrobot-team added the duplicate This issue or pull request already exists label Dec 12, 2023
@ariel3081
Copy link

Hi, is it available for the C++ library?

@greenrobot-team
Copy link
Member

greenrobot-team commented Dec 18, 2023

@ariel3081 Yes, relations are available for the C++ library. See https://cpp.objectbox.io/entity-annotations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants