blaze-persistence icon indicating copy to clipboard operation
blaze-persistence copied to clipboard

Startup error with Spring Boot 3.3.0 and Blaze Persistence Repositories

Open pedrovnarruda opened this issue 1 year ago • 5 comments

Description

After updating my project to the new Spring Boot 3.3.0, I encountered errors during the application startup in EntityView repositories (those extending EntityViewRepository) from Blaze Persistence:

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

    com.blazebit.persistence.spring.data.base.query.JpaParameters.<init>(JpaParameters.java:58)

The following method did not exist:

    'void org.springframework.data.repository.query.Parameters.<init>(java.lang.reflect.Method)'

The calling method's class, com.blazebit.persistence.spring.data.base.query.JpaParameters, was loaded from the following location:

    jar:file:{m2-path}/.m2/repository/com/blazebit/blaze-persistence-integration-spring-data-base-3.1/1.6.11/blaze-persistence-integration-spring-data-base-3.1-1.6.11.jar!/com/blazebit/persistence/spring/data/base/query/JpaParameters.class

The called method's class, org.springframework.data.repository.query.Parameters, is available from the following locations:

    jar:file:{m2-path}/.m2/repository/org/springframework/data/spring-data-commons/3.3.0/spring-data-commons-3.3.0.jar!/org/springframework/data/repository/query/Parameters.class

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

    org.springframework.data.repository.query.Parameters: file:{m2-path}/.m2/repository/org/springframework/data/spring-data-commons/3.3.0/spring-data-commons-3.3.0.jar

Action:

Correct the classpath of your application so that it contains compatible versions of the classes com.blazebit.persistence.spring.data.base.query.JpaParameters and org.springframework.data.repository.query.Parameters

The issue seems to be in the JpaParameters class of BP, which is trying to call a non-existent method in the superclass Parameters from Spring Data Commons. Additionally, this class from BP is also trying to override a method that no longer exists. image image

Expected behavior

I expected the EntityView repositories to initialize and work correctly after updating to Spring Boot 3.3.0. This update is particularly important because Spring Boot 3.3.0 includes an upgrade to Hibernate 6.5.x. The new Hibernate version brings significant improvements, including the ability to pre-generate IDs for entities that are yet to be persisted. Consider a scenario where UUIDs (PKs) are generated within a mobile application. With the new Hibernate version, you can seamlessly handle these pre-generated UUIDs during the persistence process.

Actual behavior

The application fails to start, specifically in repositories that extend EntityViewRepository, due to missing methods in the Parameters class from Spring Data Commons.

Steps to reproduce

  • Update a Spring Boot project to version 3.3.0;
  • Create a repository that extends EntityViewRepository;
  • Attempt to compile and start the application.

Environment

  • Version: 1.6.11
  • Spring Boot: 3.3.0
  • JPA-Provider: 6.5.2.Final
  • DBMS: h2, postgresql
  • Application Server: N/A

pedrovnarruda avatar May 24 '24 14:05 pedrovnarruda

This is why it's important to use a library that has strong community support.

shopera007 avatar May 26 '24 11:05 shopera007

On holidays this week, could try to take care of sb 3.0 support after that

EugenMayer avatar May 26 '24 12:05 EugenMayer

@EugenMayer Why did you find my words so offensive? It's a truism: the library is great but needs a large community. Good luck keeping up with new Spring Boot versions.

shopera007 avatar May 26 '24 12:05 shopera007

We managed to keep up with the Spring boot versions so far and will do so in the future as well, but someone from the community needs to step up and help with that. So far, @EugenMayer worked on this, so he will surely look into this when he has time. If you can't await that, please provide a PR with a fix.

beikov avatar Jun 05 '24 18:06 beikov

Started with the integration in #1912 - might take a bit since we have to create new integration libraries

EugenMayer avatar Jun 07 '24 15:06 EugenMayer