Fix Springboot Unable to build Hibernate sessionfactory @Column naming does not work

Source: Internet
Author: User

Problem:

Springboot Start Error:

caused by:org.springframework.beans.factory.BeanCreationException:Error creating bean with Name ' Entitymanagerfactory ' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/ Hibernatejpaautoconfiguration.class]: Invocation of Init method failed; Nested exception is javax.persistence.PersistenceException: [Persistenceunit:default] Unable to build Hibernate Sessionfactory

caused by:javax.persistence.PersistenceException: [Persistenceunit:default] Unable to build Hibernate sessionfactory

Springboot version 1.4.3.RELEASE
Hibernate related properties:
Spring.jpa.hibernate.ddl-auto=validate

Solve:

Configure Application.properties to

spring.jpa.hibernate.naming.physical-strategy= Org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

Process:

Configuration

Debug=truespring.jpa.show-sql=true

The note for the log hint @column (name) does not match the database field. Discover the problem.

Reason:

The JPA of Springboot is implemented by hibernate. The physical naming policy naming.physical-strategy the default configuration in Springboot is Org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy.

Put identifier name with Tounderscorecase underline naming rules and convert them once ... It's really counter-intuitive ...

In general, large companies will use the common components based on open source projects themselves to do a set of frameworks, and do not fully play the Springboot "no Configuration" integration of the advantages of the third-party framework, stepping on the pit will be more than the traditional spring a little bit ...

Fix Springboot Unable to build Hibernate sessionfactory @Column naming does not work

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.