complex entities
piniSolomon opened this issue · 3 comments
piniSolomon commented
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 commented
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
ariel3081 commented
Hi, is it available for the C++ library?
greenrobot-team commented
@ariel3081 Yes, relations are available for the C++ library. See https://cpp.objectbox.io/entity-annotations.