kundera icon indicating copy to clipboard operation
kundera copied to clipboard

Kundera/Hbase doubt with Embeddable

Open zenzei opened this issue 9 years ago • 3 comments

Hi, I'm using Kundera 3.3. Does Kundera support some kind of Embeddable inheritance? This is what I'm trying to accomplish without luck (no error but no embaddable saved).

@Entity
public class Table {
    @Id
    private String id;
    private String name ; 
    @ElementCollection
    private List<Field> columns ;
    ...
}

@Embeddable
public class Field {
    private String name ; 
    @Embedded
    private FieldType type;
    ...
}

@Embeddable
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", length = 64, discriminatorType = DiscriminatorType.STRING)
public abstract class FieldType {

    @Column(name="name")
    public abstract String getName();
}

@Embeddable
@DiscriminatorValue(value="integer")
public class IntegerFieldType extends FieldType {
    @Column(name="name")
    protected String name = "Integer";

    @Override
    public String getName() {
       return name;
    }
   ...
}

As you can see the class table has many columns (Fields) and each Field has a specific FieldType (that has a name and can have custom attributes).

The problem I have is that the attribute "name" of the Field class is saved, but not the attribute "type". I also tried using a OneToOne relationship for this "type" attribute (instead of Embedded/Embeddable) but it doesn't work either.

If this is not supported, can you recommend an alternative method to store this kind of model with Kundera?

Thanks!

zenzei avatar Feb 23 '16 15:02 zenzei

@zenzei

Which hbase are you using? kundera-hbase or kundera-hbase-v2 ?

-Karthik

karthikprasad13 avatar Feb 23 '16 15:02 karthikprasad13

Sorry, I'm using kundera-hbase-v2 (version 3.3). Thanks!

PS: Do you still use the freenode irc?

zenzei avatar Feb 23 '16 15:02 zenzei

@zenzei

We are using Gitter as chat room for Kundera now. Kundera team is available from 11:00 to 20:00 IST.

-Karthik

karthikprasad13 avatar Feb 24 '16 16:02 karthikprasad13