How are you going to access the results? Do you first lookup the order
and then the results? If so, you could do something like this:

Table 1: Order
row_key => order_id
Column Family => order { columns: order.prop1, order.prop2....}

Table 2: order_result
row_key => order_id:result_id
Column Family => result { columns: result.prop1, result.prop2....}

To lookup a specific result, do a get(order_id + ":" + result_id) on
order_result.

To get all results for an order, do a scan with startrow/endrow or a
use a prefix filter with order_id as the prefix.

Alok


On Thu, Feb 12, 2015 at 1:23 PM, Wilm Schumacher
<[email protected]> wrote:
> Am 12.02.2015 um 21:12 schrieb Dima Spivak:
>> Is there a better alternative than  above options for one to many
>> relationships?
>
> you could use a column family in table 2 for that.
>
> table 1
> result1 data:foo => bar
> result2 data:foo => baz
> result3 data:foo => bar
> result4 data:foo => baz
> ....
>
> table 2
> order1 data:metadata => foobar , result:1 => result1, result:2 => result2
> order1 data:metadata => foobaz , result:1 => result3, result:2 =>
> result4 , ....
>
> Seems to be the best plan.
>
> Best wishes
>
> Wilm

Reply via email to