Impetus / kundera

A JPA 2.1 compliant Polyglot Object-Datastore Mapping Library for NoSQL Datastores.Please subscribe to:
http://groups.google.com/group/kundera-discuss/subscribe
Apache License 2.0
903 stars 233 forks source link

Compound partition key with foreign key reference #929

Open si24803 opened 7 years ago

si24803 commented 7 years ago

Hello again, team Kundera.

First of all, thank you for your great work and top notch support. I'm using kundera-cassandra 3.8 and kundera-cassandra-ds-driver 3.8 and have a mapping problem for autogeneration of the schema. My problem is as follows:

`// parent entity A { @Id string id; string value; }

and

// child entity B { @EmbeddedId @OrderBy(value="clusterValue DESC") Bck clusteringKey; string value;

@ManyToOne @MapsId("clusterKey.partitionKey.A_ID") A a; }

Bck { @Embedded Bpk partitionKey; string clusterValue; }

// B's partition key @Embeddable Bpk { string year; string A_ID; }`

Kundera is unable to establish this relation without duplicating fields. Can you tell me if this is possible/desirable? If the mapping field is in the clustering key, it works. If the mapping field is in the B class, it also works. So why not in the partition key? I don't want the OneToMany in A since B can only be retrieved by combining both year and A_ID.

Thank you

si24803 commented 7 years ago

Of course, Bck is also Embeddable

karthikprasad13 commented 7 years ago

@si24803

Hey Pedro,

This feature is not supported in Kundera. We can discuss your use case and come up with a better data model. I am not able to understand the point of keeping a join column as a part of partition key, as it wont be useful in reverse querying if at all required.

Lets discuss on gitter.

-Karthik