objectbox/objectbox-python

complex entities

piniSolomon opened this issue · 3 comments

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

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

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

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