@Entity
@javax.persistence.Table(name = "orders_details")
@Audited
public class OrderDetail implements Serializable {
@EmbeddedId
private OrderDetailsId id;
@Embeddable
public class OrderDetailsId implements Serializable {
@Basic
@Column(name = "product_name")
private String prodName;
@Basic
@ManyToOne
@JoinColumn(name = "order_id")
private Order order;
AuditReader auditReader = AuditReaderFactory.get(em);
List list = auditReader.createQuery().forRevisionsOfEntity(Order.class, false, false).
add(AuditEntity.property("id.order").eq(id)).getResultList();
> 2017-03-08 11:48:00.548 ERROR 4548 --- [nio-8080-exec-1] > o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for > servlet [dispatcherServlet] in context with path [] threw exception > [Request processing failed; nested exception is > java.lang.NullPointerException] with root cause > java.lang.NullPointerException: null at org.hibernate.envers.internal.entities.EntitiesConfigurations.getRelationDescription(EntitiesConfigurations.java:98) > ~[hibernate-envers-5.0.11.Final.jar:5.0.11.Final] at > org.hibernate.envers.query.criteria.internal.CriteriaTools.getRelatedEntity(CriteriaTools.java:44) > ~[hibernate-envers-5.0.11.Final.jar:5.0.11.Final] at > org.hibernate.envers.query.criteria.internal.SimpleAuditExpression.addToQuery(SimpleAuditExpression.java:45) > ~[hibernate-envers-5.0.11.Final.jar:5.0.11.Final] at > org.hibernate.envers.query.internal.impl.RevisionsOfEntityQuery.list(RevisionsOfEntityQuery.java:89) > ~[hibernate-envers-5.0.11.Final.jar:5.0.11.Final] at > org.hibernate.envers.query.internal.impl.AbstractAuditQuery.getResultList(AbstractAuditQuery.java:93) > ~[hibernate-envers-5.0.11.Final.jar:5.0.11.Final] at > com.spring.dao.impl.OrderDetailsDAOImpl.getRevision(OrderDetailsDAOImpl.java:52) > ~[classes/:na] at > com.spring.dao.impl.OrderDetailsDAOImpl$$FastClassBySpringCGLIB$$38c0db60.invoke() > ~[classes/:na] at > org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) > ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) > ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > com.spring.dao.impl.OrderDetailsDAOImpl$$EnhancerBySpringCGLIB$$6146d8cb.getRevision() > ~[classes/:na] at > com.spring.service.impl.OrderServiceImpl.getOrder(OrderServiceImpl.java:78) > ~[classes/:na] at > com.spring.service.impl.OrderServiceImpl$$FastClassBySpringCGLIB$$7d1c6228.invoke() > ~[classes/:na] at > org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) > ~[spring-core-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) > ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282) > ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) > ~[spring-tx-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) > ~[spring-aop-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > com.spring.service.impl.OrderServiceImpl$$EnhancerBySpringCGLIB$$d51254c.getOrder() > ~[classes/:na] at > com.spring.web.WaitersController.getOrderDetails(WaitersController.java:61) > ~[classes/:na] at > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > ~[na:1.8.0_111] at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > ~[na:1.8.0_111] at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > ~[na:1.8.0_111] at java.lang.reflect.Method.invoke(Method.java:498) > ~[na:1.8.0_111] at > org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > javax.servlet.http.HttpServlet.service(HttpServlet.java:622) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) > ~[spring-webmvc-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > javax.servlet.http.HttpServlet.service(HttpServlet.java:729) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) > ~[tomcat-embed-websocket-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177) > ~[spring-security-web-4.2.1.RELEASE.jar:4.2.1.RELEASE] at > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) > ~[spring-web-4.3.6.RELEASE.jar:4.3.6.RELEASE] at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) > ~[tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) > [na:1.8.0_111] at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) > [na:1.8.0_111] at > org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) > [tomcat-embed-core-8.5.11.jar:8.5.11] at > java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
您获得NullPointerException
是因为您要求Envers查询API定位Order
实体的修订,您没有将该实体指定为正在审核。
我已经提交了一个JIRA问题HHH-11558,以一个更温和的回应来解决这个问题。
如果对order
进行了审核,它将按照预期工作。
我想移动在下-这可能吗?我想到了类似于或,但它不起作用。
在 PowerShell 中,如何通过指定对象的名称(字符串)来获取对象的属性值?我想要类似这样的东西: 是否有类似于“获取属性名称”的内容?
我想用scrapy来获取IMG的链接,所以我在scrapy的爬行器中编写了以下程序: 然而,这是不管用的。有什么问题吗?
id=“root” XML的一个示例 代码 //SiebelMessage[@id='root'] 你知道我做错了什么吗?
问题内容: 我在jpa中使用了hibernate模式,并且使用persistence.xml进行了配置。是否可以从Web应用程序获取hibernate连接属性? 谢谢。 问题答案: 可能并非没有反射,而是依靠Hibernate在将来不会破坏您的代码。您需要从SessionFactory获取属性,但是它不是公开的,因此您必须通过反射找到Field,然后使用field.setAccessible获取对
问题内容: 我正在使用jQuery流沙插件。我需要获取单击项的数据ID,并将其传递给Web服务。如何获得data- id属性?我正在使用该方法重新绑定单击事件以进行排序。 问题答案: 要获取属性的内容(如中的),您必须使用 或(如果您使用更新的jQuery> = 1.4.3) 并且后面的部分必须小写,例如将不起作用,但会起作用。