We're updating the issue view to help you get more done. 

Add support for joined inheritance (natural mapping for EAV stores)

Description

As an OGM implementor, I would like to be able to map individual classes via joined inheritance. Acknowledging that most NoSQL datastores do not support joins, this is a very useful strategy for at least Datomic and presumably any EAV datastore.

Given that entities in EAV stores are represented as:

[eid] [attribute name] [value]

a natural mapping between JPA entities and EAV entities would be as follows:

@Entity
@Table(name = "persistable")
@Inheritance(strategy = InheritanceType.JOINED)
public class Persistable {
@Basic
Long id;
@Basic
String name;

}

@Entity
@Table(name = "foo")
public class Foo extends Persistable {
@Basic
String bar;

}

Would map to

persistable
persistable/id
persistable/name

foo
foo/bar

as attributes in the EAV store and eliminate unnecessary duplication of attributes.

This should be relatively easy to implement, requiring a new EntityPersister, EntityDiscriminator, and the registration of the Persister with the OgmPersisterClassResolver

Environment

None

Status

Assignee

Emmanuel Bernard

Reporter

Josiah Haswell

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Time tracking

112h

Components

Affects versions

5.0.0.CR1

Priority

Major