I am working on a product that will be supporting multiple database engines (Oracle, MSSQL, MySQL). For Oracle, I would prefer to use Sequences rather than a Sequence table to avoid potential concurrency and locking issues on a high-volume installation, but other database engines do not support sequences. Furthermore, I would prefer to use one sequence per table rather than a global sequence (such as hibernate_sequence
), so @GeneratedValue(strategy = GenerationType.AUTO)
won't work. Is there a way to dynamically choose the strategy at runtime?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…