kundera icon indicating copy to clipboard operation
kundera copied to clipboard

Joining to super columns families

Open rramdin opened this issue 13 years ago • 6 comments

Is it possible to join to super colums families? In the example below, I am seeing none of the subcolumns being stored. The id column is being stored though. The motivation for using a column family for customer instead of a super column family is that I want to have secondary indexes on some customer fields.

@Entity
@Table(name = "users", schema = "data@dev")
public class Customer {
    @Id
    @Column(name="id")
    String customerId;

    @Column
    String name;

    @Column
    String phoneNumber;

    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name="id")
    Shipments shipments;

    @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
    @JoinColumn(name="id")
    Messages messages;
}

@Entity
@Table(name = "shipments", schema = "data@dev")
public class Shipments {
    @Id
    @Column(name="id")
    String customerId;

    @ElementCollection
    @CollectionTable(name="shipment")
    List<Shipment> shipments;
}

@Embeddable
public class Shipment {
    @Column
    long sendDate;

    @Column
    String warehouse;

    @Column
    String address;
}

@Entity
@Table(name = "messages", schema = "data@dev")
public class Messages {
    @Id
    @Column(name="id")
    String customerId;

    @ElementCollection
    @CollectionTable(name="shipment")
    List<Messages> messages;
}

@Embeddable
public class Message {
    @Column
    long timestamp;

    @Column
    String body;
}

rramdin avatar Jan 25 '13 21:01 rramdin

Not supported in Kundera 2.3. 2.4 will enable support. Super columns will be deprecated in near future. So i guess if you try same example with Composite key over Messages and Shipments, it should work you.

-Vivek

mevivs avatar Jan 26 '13 02:01 mevivs

Please ignore my previous comments. I missed out that User is a column family. I guess that should work.

Amresh: Please verify

-Vivek

mevivs avatar Jan 26 '13 02:01 mevivs

Hi rramdin, Association OneToOne with PrimaryKeyJoinColumn is a known bug in kundera-2.3 it will be fixed in 2.4.

Thanks and Regards Kuldeep

kkmishra avatar Jan 28 '13 10:01 kkmishra

Joining both super column families and column families is possible.

xamry avatar Jan 28 '13 11:01 xamry

Shared by primary key will be available with 2.4 release. Is there anything which need to be sum up?

-Vivek

mevivs avatar Feb 11 '13 13:02 mevivs

Shared by Primary key support added and releasing with 2.4

mevivs avatar Mar 08 '13 11:03 mevivs