Hi,
we are currently migrating from MSSQL to Oracle and we dont want to use the hibernate_sequence for all tables. Each table should have its own Sequence.
We already did the change but I'd like to get some info if our solution is safe to use..
Most of our classes are extending from baseentities but we also have a couple of stand-alone entities. What we changed:
-baseentities(@MappedSuperclass): changed: @GeneratedValue(strategy = GenerationType.AUTO) to: @GeneratedValue(strategy = GenerationType.AUTO, generator = "HIBERNATE_GENERATOR")
-extending entities: added after the @Table annotation: @SequenceGenerator(name = "HIBERNATE_GENERATOR", sequenceName = "${TABLENAME}_SEQ")
-stand-alone entities: added after the @Table annotation: @SequenceGenerator(name = "HIBERNATE_GENERATOR", sequenceName = "${TABLENAME}_SEQ") changed : @GeneratedValue(strategy = GenerationType.AUTO) to: @GeneratedValue(strategy = GenerationType.AUTO, generator = "HIBERNATE_GENERATOR")
So we are using always the same generatorname "HIBERNATE_GENERATOR", only the sequenceNames are different. Our applications seems to work fine, but is it safe to use always the same generatorname?
regards
|