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

Spring-boot 3.4.0 compatibility for JPA repositories

Open EugenMayer opened this issue 1 year ago • 6 comments

Caused by: java.util.NoSuchElementException: No value present
	at java.base/java.util.Optional.get(Optional.java:143) ~[?:?]
	at com.blazebit.persistence.spring.data.impl.repository.BlazePersistenceRepositoryFactory.getQueryLookupStrategy(BlazePersistenceRepositoryFactory.java:264) ~[blaze-persistence-integration-spring-data-3.3-1.6.14.jar:1.6.14]
	at com.blazebit.persistence.spring.data.impl.repository.BlazePersistenceRepositoryFactory.getRepository(BlazePersistenceRepositoryFactory.java:438) ~[blaze-persistence-integration-spring-data-3.3-1.6.14.jar:1.6.14]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$4(RepositoryFactoryBeanSupport.java:350) ~[spring-data-commons-3.4.0.jar:3.4.0]
	at org.springframework.data.util.Lazy.getNullable(Lazy.java:135) ~[spring-data-commons-3.4.0.jar:3.4.0]
	at org.springframework.data.util.Lazy.get(Lazy.java:113) ~[spring-data-commons-3.4.0.jar:3.4.0]
	at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:356) ~[spring-data-commons-3.4.0.jar:3.4.0]
	at com.blazebit.persistence.spring.data.impl.repository.BlazePersistenceRepositoryFactoryBean.afterPropertiesSet(BlazePersistenceRepositoryFactoryBean.java:108) ~[blaze-persistence-integration-spring-data-3.3-1.6.14.jar:1.6.14]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1849) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1798) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:523) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:336) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:288) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:334) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.instantiateSingleton(DefaultListableBeanFactory.java:1116) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingleton(DefaultListableBeanFactory.java:1093) ~[spring-beans-6.2.0.jar:6.2.0]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:1030) ~[spring-beans-6.2.0.jar:6.2.0]

Its one of our very few JPA repositories

@Repository
interface DwCacheApiRepository extends JpaRepository<DwCacheApiEntry, Long>
{}

Version: 1.6.14 JPA-Provider: Hibernate 6.6.3.Final DBMS: MariaDB 11.5
Application Server:

EugenMayer avatar Nov 21 '24 19:11 EugenMayer

The issue appears to be due to the deprecation of the method getQueryLookupStrategy(@Nullable Key key, QueryMethodEvaluationContextProvider evaluationContextProvider) replaced by the method getQueryLookupStrategy(@Nullable Key key,ValueExpressionDelegate valueExpressionDelegate) in org.springframework.data.repository.core.support.RepositoryFactorySupport, the old overwritten method in JpaRepositoryFactory not exist and is called deprecated method from parent.

nexus061 avatar Jan 07 '25 08:01 nexus061

Hi there, any update on this issue? EntityViewRepositories do not seem to work on version 3.4.1, so we have downgraded to 3.3.7, and it seems to working fine now. Thank you for all your hard work, it's really improved our team's experience working with JPA!

dylfrancis avatar Jan 17 '25 04:01 dylfrancis

Not yet, no. Maybe @Mobe91 wants to look into this?

beikov avatar Jan 17 '25 13:01 beikov

FYI, we are currently not interested in this support, since we removed all BP jpa repositories. IMHO using BP and then JPA repositories kind of seems defeating the purpose one has introduced BP for.

Replacing our JPA repositories ist pure BP implementations was not only very easy - it was better in the end.

Of course, that's a subjective take on it :) Just wanted to be transparent, that we are not looking into that (anylonger), someone else has to take over

EugenMayer avatar Jan 23 '25 07:01 EugenMayer

@EugenMayer Thanks for sharing.

If you don't mind I would still like to keep this issue open because we need to provide support for this for other users. Feel free to unsubscribe.

Mobe91 avatar Jan 23 '25 10:01 Mobe91

Sorry for closing the issue, this was entirely by accident. Not sure how I managed to hit that button. I'am happy if you continue.

EugenMayer avatar Jan 23 '25 10:01 EugenMayer

Thanks @beikov for fixing the most awaited fix.

Can you please release 1.6.16 as well. so users can upgrade.

rajadilipkolli avatar Jun 30 '25 10:06 rajadilipkolli

Don't worry, I will release by the end of the week. Waiting for confirmation on a few bug fixes first.

beikov avatar Jun 30 '25 11:06 beikov