我有一个奇怪的问题,它只发生在参考服务器上,我的本地环境中的相同代码按预期工作。阅读一些记录后,我正在尝试进行批量更新。
我写的JAVA代码是
public OrderDTO findRecurringOrder(Integer userId, Integer itemId) {
Criteria criteria = getSession().createCriteria(OrderDTO.class)
.createAlias("orderStatus", "s")
.add(Restrictions.eq("s.id", Constants.ORDER_STATUS_ACTIVE))
.add(Restrictions.eq("deleted", 0))
.createAlias("baseUserByUserId", "u")
.add(Restrictions.eq("u.id", userId))
.createAlias("orderPeriod", "p")
.add(Restrictions.ne("p.id", Constants.ORDER_PERIOD_ONCE))
.createAlias("lines", "l")
.createAlias("l.item", "i")
.add(Restrictions.eq("i.id", itemId))
.addOrder(Order.desc("id"))
.setMaxResults(1);
return findFirst(criteria);
}
public T findFirst(Criteria criteria) {
criteria.setFirstResult(0).setMaxResults(1);
return (T) criteria.uniqueResult();
}
我得到的错误堆栈跟踪是:
groovy.lang.MissingMethodException: No signature of method: com.sapienter.jbilling.server.order.db.OrderLineDTO.validate() is applicable for argument types: (java.util.LinkedHashMap) values: [[deepValidate:false]]
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125)
at org.codehaus.groovy.grails.orm.hibernate.support.ClosureEventTriggeringInterceptor.onPreUpdate(ClosureEventTriggeringInterceptor.groovy:168)
at org.hibernate.action.EntityUpdateAction.preUpdate(EntityUpdateAction.java:237)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:88)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1589)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:328)
at com.sapienter.jbilling.server.util.db.AbstractDAS.findFirst(AbstractDAS.java:212)
at com.sapienter.jbilling.server.order.db.OrderDAS.findRecurringOrder(OrderDAS.java:88)
at com.sapienter.jbilling.server.mediation.task.SubscriptionEventProcessor.doEventAction(SubscriptionEventProcessor.java:134)
at com.sapienter.jbilling.server.mediation.task.AbstractResolverMediationTask.resolve(AbstractResolverMediationTask.java:126)
at com.sapienter.jbilling.server.mediation.task.AbstractResolverMediationTask.process(AbstractResolverMediationTask.java:93)
at com.sapienter.jbilling.server.mediation.MediationSessionBean.normalizeRecordGroup(MediationSessionBean.java:476)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy75.normalizeRecordGroup(Unknown Source)
at com.sapienter.jbilling.server.mediation.MediationSessionBean.performMediation(MediationSessionBean.java:232)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy75.performMediation(Unknown Source)
at com.sapienter.jbilling.server.mediation.MediationSessionBean$1.run(MediationSessionBean.java:182)
at java.lang.Thread.run(Thread.java:662)
有什么建议吗,我真的对这个 Hibernate 异常知之甚少?