Dialect does not support identity Key Generation

Source: Internet
Author: User

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

    1. <Props>
    2. <Prop key ="Hibernate. dialect">
    3. Org. hibernate. dialect. oracledialect // replace it with MySQL Dialect
    4. </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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.