Subject Re: [Firebird-Java] hibernate reverse engeneering - id - @SequenceGenerator annotation
Author Mark Rotteveel
On 11-5-2017 16:12, pablos@... [Firebird-Java] wrote:
> I'm using eclipse neon and hibernate 5.2.10 (as a JPA project) with
> firebrd 2.5 .
> After serveral attempts to "reveng" a test db, with id's using
> Generators I see no way to get the :
> @SequenceGenerator(name = "seqName", sequenceName = "GEN_TABLE_ID",
> allocationSize = 1) annotation code in the generated class for any table.
> "GEN_TABLE_ID" is the firebird db generator name for that table id .
> Is there anything I can do to make it work automatically o should i
> waste no more time on this
> (just code it in) ?

Just code it in manually, as far as I know there is no way for the
reverse engineering to infer that the sequence `GEN_TABLE_ID` would
belong to a specific table (and if there were any such inference by
name, I'd guess that `SEQ_TABLE_ID` would sooner work). However I
usually do not reverse engineer at all, so don't take this as the final

Note that it would probably yield better performance to use a trigger
(or Firebird 3 identity column) to generate the id, and mark the id as
`@GeneratedValue(strategy = GenerationType.IDENTITY)` instead.

Mark Rotteveel