Subject Re: returning generated keys
Author Roman Rokytskyy
> I note that a call to
> Statement.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS)
> currently raises an exception with a 'not yet implemented'
> message. I imagine this has a lot to do with there being
> no 'autoinc' type in firebird? (yes I'm using a trigger and a
> generator).

You are right. This method does not works because server does not
have autoinc datatype.

> Does anyone have a clever and (most importaintly) portable way of
> doing the same thing? Although we are currently using Firebird for
> development, ultimatly our clients will be making the call as to
> which database the app will run on so we need to keep it all as
> generic as possible.

Split ID generation and statement execution into two separate steps.
You can decide if you want to make these steps visible on the
interface level, or only in the implementation.

Another approach can be creating a stored procedure that performs
insert and returns you generated ID. But in this case you need to use
CallableStatement or PreparedStatement.executeQuery().

Best regards,
Roman Rokytskyy