spring-projects / spring-data-jpa

Simplifies the development of creating a JPA-based data access layer.
https://spring.io/projects/spring-data-jpa/
Apache License 2.0
2.93k stars 1.39k forks source link

After upgrade to 3.2.4, when use @Query to query native sql will bootstrap fail, as the jsqlparser version too lower. Below is the error message. #3436

Closed 892744577 closed 2 months ago

892744577 commented 2 months ago

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

org.springframework.data.jpa.repository.query.JSqlParserQueryEnhancer.detectAlias(JSqlParserQueryEnhancer.java:322)

The following method did not exist:

'net.sf.jsqlparser.statement.select.SelectBody net.sf.jsqlparser.statement.select.Select.getSelectBody()'

The calling method's class, org.springframework.data.jpa.repository.query.JSqlParserQueryEnhancer, was loaded from the following location:

jar:file:/Users/leon.tang/.m2/repository/org/springframework/data/spring-data-jpa/3.2.4/spring-data-jpa-3.2.4.jar!/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.class

The called method's class, net.sf.jsqlparser.statement.select.Select, is available from the following locations:

jar:file:/Users/leon.tang/.m2/repository/com/github/jsqlparser/jsqlparser/4.9/jsqlparser-4.9.jar!/net/sf/jsqlparser/statement/select/Select.class

The called method's class hierarchy was loaded from the following locations:

Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.data.jpa.repository.query.JSqlParserQueryEnhancer and net.sf.jsqlparser.statement.select.Select

christophstrobl commented 2 months ago

data-jpa:3.2.4 requires jsqlparser:4.5 and cannot be used with jsqlparser:4.9 due to breaking changes within jsqparser. Newer versions of jsqlparser will be supported by data-jpa:3.3 once released.