Oracle database does not support auto-increment of primary keys
If this error occurs in MySQL, check the configuration of the data source in spring in the application.
Sessionfactory<Property name ="Hibernateproperties">
In
- <Props>
- <Prop key ="Hibernate. dialect">
- Org. hibernate. dialect. oracledialect // replace it with MySQL Dialect
- </Prop>
Oracle does not support identity. sequence is supported,
@ Generatedvalue (Strategy = identity)
Change to sequence
You use sqlservser, and how can dialect use Oracle,
If you want to use Oracle without the sequece name, Hibernate uses the default name hibernate_sequence.
You must create a sequence named hibernate_sequence.
Well, the few upstairs are right. You connect to SQL Server in Oracle dialect. Of course, this is a mess.
In addition, even if the dialect is paired, if it is not a special need for the project, the ID generator does not need to be configured based on the database product. It uses native directly to use all dialects. This will facilitate database migration in the future. In case of a special generator with a specified ID, it will not be too late to change it.
PS: if the data volume is too large and the addition and deletion operations are extremely frequent, it is not appropriate for the database to automatically generate keys. In this case, we recommend that you customize the generator class, call a stored procedure to obtain the next id based on the specific logic.
Dialect does not support identity Key Generation