|
Following along my last comment...
So maybe the solution here is different annotations for each of the 3 generic use cases (please forgive names):
-
@GeneratorGeneratedValue - this is the case where we allow the user to hand us a "generator" and we use that to generate values. This could follow the pattern described by Gunnar in terms of extension.
-
@FunctionGeneratedValue - this is the case where the user tells us a database function (ideally tying in with the FunctionRegistry) to use to generate values. We'd then embed a call into the indicated function in the SQL. Perhaps we also allow for specifying that the we should call the function and pass its result back to the database for the INSERT/UPDATE (like a simplified form of @GeneratorGeneratedValue for the case where the generator would call a DB function).
-
@DatabaseGeneratedValue - indicates a case where the database is generating the value, typically via a default value or a trigger. We'd need to accept an indication of whether to include the column in the SQL. In either case, read back the generated value after execution of the SQL.
|