My use case is this:
I have implemented a distributed key using triggers.
A distributed key is a unique constraint that reaches over more than one
table.
In pseudo sql it could be deifined as
CREATE DISTRIBUTED KEY DKEY_NAME(schema.table1.col1, schema.table2.col2,
...);
This can not be achieved by using sequences because a sequence does not
guard uniqueness over
many columns in many tables.
In addition to guarding the uniqueness the distributed key is able to
generate a new unique id
when insert is executed on any of the tables that are part of the
distributed key.
If I would only use a sequence it would not guard the uniqueness of
these columns but only
generate a new id in reference to the sequence itself.
I need the ability to set the scope id from trigger so that the
generated key would be returned
to in the method Statement.getGeneratedKeys()
Of course the distributed key feature could be implemented as part of H2
proper but I think
that implementing new features first with triggers is a great way to
test the functionality before
trying to include it as h2 proper.
- Rami
On 8.10.2010 21:59, Thomas Mueller wrote:
Hi,
I don't understand your use case. Why don't you use sequences or
auto-increment keys? What problem do you want to solve? What about
being database independent?
Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.