在我的程序代码和实体工作正常,但在任何时候随机发生此错误。 如果我重新启动服务器它开始工作,但几天后再次出现同样的问题。 以下是错误的日志脚本:
com.pb.gpp.backoffice.job.Exception.GPPBackOfficeException: Error occured during select operation in following method and tablegetFileTypeDetail, transactionfiletype and transactionfiledetail at com.pb.gcs.backoffice.transaction.controller.DaoImpl.getFileTypeDetail(DaoImpl.java:74) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) 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$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at com.sun.proxy.$Proxy178.getFileTypeDetail(Unknown Source) at com.pb.gcs.backoffice.transaction.filecreate.writer.TransactionFileWriter.getCompletePath(TransactionFileWriter.java:178) at com.pb.gcs.backoffice.transaction.filecreate.writer.TransactionFileWriter.initializeItemWriter(TransactionFileWriter.java:163) at com.pb.gcs.backoffice.transaction.filecreate.writer.TransactionFileWriter.beforeStep(TransactionFileWriter.java:61) ... 16 more Caused by: org.hibernate.ObjectNotFoundException: No row with the given identifier exists: [com.pb.gcs.backoffice.transaction.model.configuration.TransactionfiledetailEntity#311] at org.hibernate.internal.SessionFactoryImpl$1$1.handleEntityNotFound(SessionFactoryImpl.java:244) at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:212) at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:262) at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:150) at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1098) at org.hibernate.internal.SessionImpl.internalLoad(SessionImpl.java:1025) at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:671) at org.hibernate.type.EntityType.resolve(EntityType.java:489) at org.hibernate.type.ComponentType.resolve(ComponentType.java:667) at org.hibernate.type.ComponentType.nullSafeGet(ComponentType.java:349) at org.hibernate.type.ManyToOneType.hydrate(ManyToOneType.java:190) at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2926) at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1673) at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1605) at org.hibernate.loader.Loader.getRow(Loader.java:1505) at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:713) at org.hibernate.loader.Loader.processResultSet(Loader.java:943) at org.hibernate.loader.Loader.doQuery(Loader.java:911) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(
public FileTypeDetail getFileTypeDetail(String partnerId, String carrier) throws GPPBackOfficeException {
try {
Session session = configurationSessionFactory.getCurrentSession();
session.clear();
String query = " Select tft.*, tfd.*" +
"from transactionfiletype tft " +
"join transactionfiledetail tfd " +
"on tft.filetype=tfd.filetype " +
"where tfd.activeflag=1 and tfd.filetype ='transactionfile' and tfd.partnerid =:partnerId and tfd.carrier =:carrier";
Query queryFileTypeMapping = session.createSQLQuery(query)
.addEntity("transactionfiletype", TransactionfiletypeEntity.class)
.addEntity("transactionfiledetail", TransactionfiledetailEntity.class);
queryFileTypeMapping.setParameter("partnerId", partnerId);
queryFileTypeMapping.setParameter("carrier", carrier);
List<Object[]> resultList = queryFileTypeMapping.list();
session.flush();
List<FileTypeDetail> fileTypeDetailList = new ArrayList<FileTypeDetail>();
FileTypeDetail fileTypeDetail;
for (Object[] fileDetail : resultList) {
fileTypeDetail = new FileTypeDetail();
fileTypeDetail.setTransactionfiletypeEntity((TransactionfiletypeEntity) fileDetail[0]);
fileTypeDetail.setTransactionfiledetailEntity((TransactionfiledetailEntity) fileDetail[1]);
fileTypeDetailList.add(fileTypeDetail);
}
return fileTypeDetailList.get(0);
} catch (Exception ex) {
GPPBackOfficeException gppBackOfficeException = new GPPBackOfficeException(Constants.SYSTEM_PREFIX, Constants.ERROR_CODE_0019, helper.getExceptionInfo(Constants.SYSTEM_PREFIX, Constants.ERROR_CODE_0019).getErrorclientmessage()
+ "getFileTypeDetail, transactionfiletype and transactionfiledetail", ex);
throw gppBackOfficeException;
}
}