Skip to content

[core] support embeddable/embedded entities #138

@CrystalMethod

Description

@CrystalMethod

In some cases it makes sense to embed entities in some other entity.

@Embeddable
interface Address {
  ...
}

@Label // any other "entity" annotation
interface Person {
  ...
  @Embedded
  Address getAddress();
}

invalid:

xoManager.currentTransaction().begin();
Address a = xoManager.create(Address.class);
Person p = xoManager.create(Person.class);
p.setName("..");
xoManager.currentTransaction().commit(); // a will not have been persisted

valid:

xoManager.currentTransaction().begin();
Address a = xoManager.create(Address.class);
Person p = xoManager.create(Person.class);
p.setName("..");
p.setAddress(a);
xoManager.currentTransaction().commit();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions