Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cda opened DATAJPA-1290 and commented
Given the following classes:
@Embeddable public class PriceHistoryId implements Serializable { private Product product; private OffsetDateTime date; }
@Entity @IdClass(PriceHistoryId.class) public class PriceHistory { @NotNull @Embedded private Price price; @Id @NotNull protected OffsetDateTime date; @Id @ManyToOne @NotNull @JoinColumn private Product product; }
@Repository public interface PriceHistoryRepository extends JpaRepository<PriceHistory, PriceHistoryId> { boolean existsByProduct( Product product ); }
throws NullPointerException when building repository bean:
Caused by: java.lang.IllegalArgumentException: Failed to create query method public abstract boolean PriceHistoryRepository.existsByProduct(Product)! null at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:76) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:101) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:207) at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:77) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:436) at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:221) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:277) at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:263) at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:101) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624) ... 83 more Caused by: java.lang.NullPointerException at org.hibernate.jpa.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:123) at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:187) at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:143) at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:52) at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:88) at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:73) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery$QueryPreparer.<init>(PartTreeJpaQuery.java:133) at org.springframework.data.jpa.repository.query.PartTreeJpaQuery.<init>(PartTreeJpaQuery.java:72) ... 93 more
Issue is in JpaQueryCreator.java(line 187):
selections.add(root.get((SingularAttribute) id).alias(id.getName()));
where id variable is null.
This issue is replicable only with an exists query. Issue is replicable also with spring-data-jpa version 1.11.10.RELEASE.
No further details from DATAJPA-1290
The text was updated successfully, but these errors were encountered:
No branches or pull requests
spring-projects-issues commentedMar 14, 2018
cda opened DATAJPA-1290 and commented
Given the following classes:
throws NullPointerException when building repository bean:
Issue is in JpaQueryCreator.java(line 187):
where id variable is null.
This issue is replicable only with an exists query.
Issue is replicable also with spring-data-jpa version 1.11.10.RELEASE.
No further details from DATAJPA-1290
The text was updated successfully, but these errors were encountered: