- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我被这个错误困住了:
我想使用一种方法,通过 QueryDslPredicateExecutor
对谓词进行搜索。当该方法在我的服务实现上运行时,出现此错误:
16:59:44,165 DEBUG [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] (http-localhost-127.0.0.1-9090-4) Resolving exception from handler [public br.com.cleartech.itx.web.dto.PageDto br.com.cleartech.itx.web.controller.CngController.list(br.com.cleartech.itx.core.domain.Cng,org.springframework.data.domain.Pageable)]: org.springframework.data.mapping.PropertyReferenceException: No property cng found for type Cng!
16:59:44,167 DEBUG [org.springframework.web.servlet.mvc.method.annotation.ExceptionHandlerExceptionResolver] (http-localhost-127.0.0.1-9090-4) Invoking @ExceptionHandler method: public org.springframework.web.servlet.ModelAndView br.com.cleartech.itx.web.exception.WebExceptionHandler.runtime(java.lang.Exception)
16:59:44,169 ERROR [br.com.cleartech.itx.web.exception.WebExceptionHandler] (http-localhost-127.0.0.1-9090-4) No property cng found for type Cng!
16:59:44,170 DEBUG [org.springframework.web.servlet.DispatcherServlet] (http-localhost-127.0.0.1-9090-4) Handler execution resulted in exception - forwarding to resolved error view: ModelAndView: reference to view with name 'error'; model is {exception=org.springframework.data.mapping.PropertyReferenceException: No property cng found for type Cng!}: org.springframework.data.mapping.PropertyReferenceException: No property cng found for type Cng!
at org.springframework.data.mapping.PropertyPath.<init>(PropertyPath.java:75) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:327) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.data.mapping.PropertyPath.create(PropertyPath.java:307) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:270) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.data.mapping.PropertyPath.from(PropertyPath.java:241) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.data.jpa.repository.query.QueryUtils.toJpaOrder(QueryUtils.java:448) [spring-data-jpa-1.6.5.RELEASE.jar:]
at org.springframework.data.jpa.repository.query.QueryUtils.toOrders(QueryUtils.java:411) [spring-data-jpa-1.6.5.RELEASE.jar:]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:499) [spring-data-jpa-1.6.5.RELEASE.jar:]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.getQuery(SimpleJpaRepository.java:480) [spring-data-jpa-1.6.5.RELEASE.jar:]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:362) [spring-data-jpa-1.6.5.RELEASE.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:405) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:390) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:344) [spring-data-commons-1.8.5.RELEASE.jar:]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) [spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) [spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) [spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155) [spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodIntercceptor.invoke(CrudMethodMetadataPostProcessor.java:119) [spring-data-jpa-1.6.5.RELEASE.jar:]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at com.sun.proxy.$Proxy126.findAll(Unknown Source)
at br.com.cleartech.itx.core.service.impl.CngServiceImpl.search(CngServiceImpl.java:26) [itx-core-0.0.1-SNAPSHOT.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) [spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) [spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) [spring-tx-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at com.sun.proxy.$Proxy127.search(Unknown Source)
at br.com.cleartech.itx.web.controller.CngController.list(CngController.java:41) [classes:]
at br.com.cleartech.itx.web.controller.CngController$$FastClassBySpringCGLIB$$48ccc37.invoke(<generated>) [spring-core-3.2.13.RELEASE.jar:]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:700) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64) [spring-security-core-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:633) [spring-aop-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at br.com.cleartech.itx.web.controller.CngController$$EnhancerBySpringCGLIB$$1abe0d77.list(<generated>) [spring-core-3.2.13.RELEASE.jar:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]
at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:743) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:672) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:82) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:851) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:953) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:855) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:829) [spring-webmvc-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) [spring-security-web-3.2.6.RELEASE.jar:3.2.6.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:343) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:260) [spring-web-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final-RECOMPILE.jar:7.1.1.Final]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
我的代码如下:
我的实体:
@Entity
@Table(name = "CNG")
public class Cng {
@Id
@SequenceGenerator(name = "SEQ_CNG", sequenceName = "SEQ_CNG", allocationSize = 1, initialValue= 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_CNG")
@Column(name = "PK_ID_CNG")
private Long pkIdCng;
@ManyToOne
@JoinColumn(name = "FK_ID_OPERADORA", nullable = false)
private Operadora operadora;
@Column(name = "RN2")
private String rn2;
@Column(name = "NGEO")
private String ngeo;
@ManyToOne
@JoinColumn(name = "FK_ID_PREFIXO", nullable = false)
private Prefixo prefixo;
@Column(name = "FAIXA_INICIAL")
private String faixaInicial;
@Column(name = "FAIXA_FINAL")
private String faixaFinal;
@Column(name = "INFO_SOLICITACAO")
private String infoSolicitacao;
@Column(name = "DT_CADASTRO")
@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
private Timestamp dtCadastro;
@Column(name = "FL_ATIVO", precision = 1, scale = 0, nullable = false)
@Enumerated(EnumType.ORDINAL)
private TipoSituacao situacao;
private static final QCng qCng = QCng.cng;
/**
* Cria um novo Predicate com propriedades diferente de null.
* Create a Predicate with not null properties.
* @return {@link com.mysema.query.types.Predicate}
*/
public Predicate toPredicate() {
BooleanBuilder builder = new BooleanBuilder();
if (pkIdCng!= null) {
builder.and(qCng.pkIdCng.eq(pkIdCng));
}
if (operadora != null) {
builder.and(qCng.operadora.cdEot.eq(operadora.getCdEot()));
}
if (rn2!= null) {
builder.and(qCng.rn2.eq(rn2));
}
if (ngeo!= null) {
builder.and(qCng.ngeo.eq(ngeo));
}
if (prefixo != null) {
builder.and(qCng.prefixo.idPrefixo.eq(prefixo.getIdPrefixo()));
}
if (faixaInicial!= null) {
builder.and(qCng.faixaInicial.eq(faixaInicial));
}
if (faixaFinal!= null) {
builder.and(qCng.faixaFinal.eq(faixaFinal));
}
if (infoSolicitacao!= null) {
builder.and(qCng.infoSolicitacao.eq(infoSolicitacao));
}
if (dtCadastro != null) {
builder.and(qCng.dtCadastro.loe(dtCadastro));
}
builder.and(qCng.situacao.eq(TipoSituacao.ATIVO));
return builder;
}
@Override
public int hashCode() {
}
@Override
public boolean equals(Object obj) {
}
}
我的 Controller :
public @ResponseBody PageDto list(@RequestBody Cng filtro, @PageableDefault(page = 1, size = 15) Pageable pageable) {
List<Cng> items = new ArrayList<>();
Page<Cng> page = cngService.search(filtro.toPredicate(), pageable);
if (!page.getContent().isEmpty()) {
items = page.getContent();
}
return ViewUtils.setPaging(items, page);
}
我的服务实现:
@Service
public class CngServiceImpl implements CngService {
@Autowired private CngRepository repository;
public Page<Cng> search(Predicate predicate, Pageable pageable) {
Page<Cng> page = repository.findAll(predicate, pageable);
return page;
}
}
还有我的存储库界面:
public interface CngRepository extends JpaRepository<Cng, Long>,
QueryDslPredicateExecutor<Cng> {
//...//
}
我不明白这是怎么回事...请帮忙;谢谢
最佳答案
从堆栈跟踪可以明显看出,您正在将某种带有 Pageable
的 Sort
对象传递给 findAll(…)
方法。这种排序表达式似乎以 cgn
开头。但是,您的类 Cgn
没有名为 cgn
的属性,这正是异常消息告诉您的内容。
org.springframework.data.mapping.PropertyReferenceException: No property cng found for type Cng!
关于java - 带有 Predicate 的 Spring Data JPA 方法 findAll() - QueryDslPredicateExecutor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30630788/
如何通过特定条件获取值,然后使用这些选定元素从其他事实系列中获取值? 我有这个代码 %code, date, amount values1('AAA', date(02, 03, 2020), 100
我是 Python 的新手,主要需要它来从网站获取信息。在这里,我试图从网站底部获取简短的标题,但无法完全获取。 from bfs4 import BeautifulSoup import reque
我不断收到错误“缺少 1 个必需的位置参数:'section_url'” 每次我尝试使用 findall 时都会收到此错误。 刚开始学习 python,因此我们将不胜感激! from bs4 impo
我有这张 table 。客户有项目,用户在项目中工作 Clients - id - name Projects - id - name - client_id Users - id - name Us
嗨,我是 Python 和 Beautiful 汤的新手。我试图仅从表格的某个部分获取文本。但似乎 findAll 的结果不是我可以再次运行 findAll 的 BeautifulSoup 类型。 s
登录 @ApiModel @Entity public class Login { @Id @GeneratedValue(strategy = GenerationType.AUTO
登录 @ApiModel @Entity public class Login { @Id @GeneratedValue(strategy = GenerationType.AUTO
有什么方法可以防止 Spring Data REST 为覆盖的存储库方法创建/search URL? 例如,以下代码会生成一个/search/findAll URL,它复制了集合资源的功能: publ
有什么方法可以防止 Spring Data REST 为覆盖的存储库方法创建/search URL? 例如,以下代码会生成一个/search/findAll URL,它复制了集合资源的功能: publ
使用 Spring Data JpaRepository 可以通过某种排序获取给定 Id 的选择集合。这意味着我需要启用以下查询。我找到了一些 solution应用@NamedQuery 但我无法启用
我正在尝试在我的 Express 应用程序中使用 Sequelize 获取数据,并使用 MSSQL 获取数据库。这是我的代码: getInstitution: function (req, res)
代码应该在请求/tasks 时返回一个带有空任务的 JSON 对象,而是返回一条消息错误 - TypeError: cannot read property 'findAll' of undefine
我的python版本是2.7.6 我知道 +? 是 + 的非贪婪版本。 这样 re.findall('(ab)+?', 'abab') 将匹配尽可能少的 ab。 结果 ['ab', 'ab'] 因此有
我正在使用 sequelize 从 mySql db 获取数据。这就是我如何使用它 const isProduct = await models.product.findAll({ where:
ItemTag对象包含一个Item对象和一个Tag对象。 (这些是Java域对象。) 这个简单的查询按预期工作。我返回一个ItemTags列表,并且可以完成ItemTags应该做的所有奇妙的事情: d
试图简单地使用find all运行域对象的查询,并且它的行为不像我期望的那样: searchResults = Contact.findAll("from Contact as c where c.c
我想使用 groovy findAll 和我的参数来过滤闭包 filterClosure = { it, param -> it.getParam == param } 我现在如何在 findAl
我扩展了 CrudRepository 来创建一个名为 TaskDao 的类。我认为 taskDao.findall() 会从数据库中提取值。由于某种原因,taskDao.findall() 实际上返
我正在开发一个 grails 应用程序,在此我必须在 list.gsp 上应用过滤器框。当我使用以下查询(在我的服务中)进行过滤时,我得到了分页列表: def clientCriteria =
我正在尝试创建一个正则表达式来查找 Perl 代码中的所有变量。 变量如下所示:$variable_test。 所以这是我使用的正则表达式: ^\$\w+$ 这给了我Python中的这一行: matc
我是一名优秀的程序员,十分优秀!