Spring integrated jpa stepping on the pit(2)

Because the project was too busy, I finally had time to learn jpa again today. I didn't expect that I was given a head start when I first came up. I reported several mistakes in a row and recorded them.

Error message solution
java.sql.SQLSyntaxErrorException: Table ‘sell.hibernate_sequence’ doesn’t exist Add @GeneratedValue(strategy = GenerationType.IDENTITY) to the entity class
org.hibernate.LazyInitializationException: could not initialize proxy [com.yz.dataobject.ProductCategory#2] - no Session

1. Add spring.jpa.open-in-view=true to the configuration file

2. Add spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true to the configuration file

3. Add @Proxy(lazy = false) to the entity class

org.hibernate.exception.ConstraintViolationException: could not execute statement There are many reasons for this error, usually due to duplicate fields
java.lang.IllegalArgumentException: Parameter value element [1] did not match expected type [java.lang.String (n/a)] Method parameter type is incorrect
java.lang.IllegalStateException: Failed to load ApplicationContext Used a method not supported by jap

Continue to update

Guess you like

Origin blog.csdn.net/qq_38306425/article/details/102768117