ObjectDB ObjectDB

Issue #146: When using inheritance, you can specify, which ID to use

Type: Feature RequestVersion: 2.0.5Priority: NormalStatus: ActiveReplies: 0
#1

When storing objects with inheritance, it should be possible to choose, which ID (parent or child class) should be used for new object. For example:

public EntityA() {
    @Id
    long id;
    String field1;
}

 

public EntityB() extends EntityA() {
    @Id
    long id;
    String field2;
}

In this case and current version of ODB, ID will be generated from EntityA. It should be possible to trigger generating ID from child entity, for example like this:

public abstract EntityA() {
    String field1;

    public abstract long getID();
    public abstract void setID(long id); 
}

 

public EntityB() extends EntityA() {
    @Id
    long id;
    String field2;

    public long getID();
    public void setID();
}

In this case new objects will get their ID from child class and can use individual sequence generator settings.

 

 

 

edit
delete

Reply

To post on this website please sign in.