简体   繁体   中英

GenerationType.AUTO not picking appropriate strategy

I am working on a requirement where code should support oracle and MySQL databases. We are using hibernate and trying to achieve the same using framework capabilities.For Identity columns, we are using @GeneratedValue annotation to manage auto-generated IDs keeping strategy as GenerationType.AUTO.

The documentation for GenerationType.AUTO says:

Indicates that the persistence provider should pick an appropriate strategy for the particular database.

Its using table strategy for MySQL.

Please suggest how an Entity Identifier should be configured so that it uses the sequence for Oracle and Auto Increment for MySql.

通过将以下内容添加到休眠属性来禁用新的生成器映射后,效果很好。

hibernate.id.new_generator_mappings=false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM