On 19 Jun 2014, at 14:54, Gunnar Morling <gun...@hibernate.org> wrote:

>> valueColumnName is something that I elected no to use because NoSQL we bind 
>> to so far do not have a strong schema. And at at given segmentColumnValue 
>> only correspond a single value. It would come and bite me if someone for the 
>> same segment value had two different value column names to differentiate two 
>> different sequence.
>> 
>> Would it really bite you? I think e.g. MongoDB could perfectly handle this 
>> case via two different fields for the two sequences in the same 
>> document/segment.
> 
> @TableGenerator(
>       name=“1”,
>       table=“Seq_table”,
>       pkColumnName=“key”,
>       pkColumnValue=“1”,
>       valueColumnName=“value1”
> )
> @TableGenerator(
>       name=“2”,
>       table=“Seq_table”,
>       pkColumnName=“key”,
>       pkColumnValue=“1”,
>       valueColumnName=“value2”
> )
> 
> The two definitions share the same options except for valueColumnName.
> The table is roughly as followed
> 
> TABLE(Seq_table)
> key    |    value1   |   value2
> 1        |   10           |  24
> 
> What would be the MongoDB representation in your approach?
> 
> It would look like this: 
> 
>     { 
>         "_id" : 1,
>         "value1" : 10,
>         "value2" : 24
>     }
> 
> So you would get the different sequence values from different fields of that 
> same document. But I wouldn't recommend to do so due to the potential 
> contention on that single record. Thus I'd raise at least a warning during 
> bootstrap. As it's not portable to stores with a fixed schema, I'd rather not 
> support it at all, though, and raise an error.

Exactly. But that’s the thing, AFAIK we do *not* store it that way today as we 
don’t use valueColumnName. So today we store it like this

{
   “_id”: 1,
   “sequence_value”: 10
}

so 10 and 24 has to both live at the same time in sequence _value.

_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to