這是我GetLastTrade在那裏我想要得到的另一種方法 INT stockdata計數INT結果正在這裏稱爲:錯誤而執行一個SQL查詢(春季)
public StockData GetLastTrade(String UserName, String SymbolName, StockData stockData)
{
System.out.println("error in GetLastTrade " + SymbolName + "username==" + UserName + "TRANSDATE ==" + stockData.getTRANSDATE() + "OPENPRICE==" + stockData.getOPENPRICE());
try
{
System.out.println("GetLastTrade done==" + stockData.getTRANSDATE());
return stockDataService.GetLastTrade(UserName, SymbolName, stockData);
}
catch(Exception e)
{
System.out.println("stockDataService.GetLastTrade error" +e);
e.printStackTrace();
}
return stockData;
}
這是INT countStockData在我的代碼:
public int countStockData(String UserName, String SymbolName, StockData stockData)
{
String transdateforquery = stockData.getTRANSDATE();
try
{
return template.queryForInt(
"SELECT COUNT(TRANSDATE) FROM stockdata WHERE transdate= ? AND symbolname = ?",
rowMapper,transdateforquery, SymbolName);
}
catch (TransientDataAccessResourceException e)
{
System.out.println("TransientDataAccessResourceExc eption====");
// TODO Auto-generated catch block
e.printStackTrace();
return 0;
}
}
IM收到此錯誤:
TransientDataAccessResourceException====
org.springframework.dao.TransientDataAccessResourc eException: PreparedStatementCallback; SQL [SELECT COUNT(TRANSDATE) FROM stockdata WHERE transdate= ? AND symbolname = ?]; Invalid argument value: java.io.NotSerializableException; nested exception is java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
at org.springframework.jdbc.support.SQLStateSQLExcept ionTranslator.doTranslate(SQLStateSQLExceptionTran slator.java:107)
at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackS QLExceptionTranslator.translate(AbstractFallbackSQ LExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:602)
at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:636)
at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:665)
at org.springframework.jdbc.core.JdbcTemplate.query(J dbcTemplate.java:673)
at org.springframework.jdbc.core.JdbcTemplate.queryFo rObject(JdbcTemplate.java:716)
at org.springframework.jdbc.core.JdbcTemplate.queryFo rObject(JdbcTemplate.java:727)
at org.springframework.jdbc.core.JdbcTemplate.queryFo rInt(JdbcTemplate.java:754)
at org.springframework.jdbc.core.simple.SimpleJdbcTem plate.queryForInt(SimpleJdbcTemplate.java:121)
at com.ib.client.mts.backend.DAO.StockDataService.cou ntStockData(StockDataService.java:362)
at com.ib.client.mts.backend.BusinessService.TradingB usinessService.GetStockDataCount(TradingBusinessSe rvice.java:262)
at com.ib.client.mts.backend.BusinessService.MtsRuleE ngineService.AnalyseRow(MtsRuleEngineService.java: 205)
at com.ib.client.mts.backend.DAO.UploadDAO.csvinput(U ploadDAO.java:175)
at com.ib.client.mts.backend.DAO.FileUploadService.do Upload(FileUploadService.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at flex.messaging.services.remoting.adapters.JavaAdap ter.invoke(JavaAdapter.java:421)
at flex.messaging.services.RemotingService.serviceMes sage(RemotingService.java:183)
at flex.messaging.MessageBroker.routeMessageToService (MessageBroker.java:1503)
at flex.messaging.endpoints.AbstractEndpoint.serviceM essage(AbstractEndpoint.java:884)
at flex.messaging.endpoints.AbstractEndpoint$$FastCla ssByCGLIB$$1a3ef066.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy. java:191)
at org.springframework.aop.framework.Cglib2AopProxy$C glibMethodInvocation.invokeJoinpoint(Cglib2AopProx y.java:692)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :150)
at org.springframework.aop.framework.adapter.ThrowsAd viceInterceptor.invoke(ThrowsAdviceInterceptor.jav a:124)
at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
at org.springframework.aop.framework.Cglib2AopProxy$F ixedChainStaticTargetInterceptor.intercept(Cglib2A opProxy.java:576)
at flex.messaging.endpoints.AMFEndpoint$$EnhancerByCG LIB$$3cc0debb.serviceMessage(<generated>)
at flex.messaging.endpoints.amf.MessageBrokerFilter.i nvoke(MessageBrokerFilter.java:121)
at flex.messaging.endpoints.amf.LegacyFilter.invoke(L egacyFilter.java:158)
at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:44)
at flex.messaging.endpoints.amf.BatchProcessFilter.in voke(BatchProcessFilter.java:67)
at flex.messaging.endpoints.amf.SerializationFilter.i nvoke(SerializationFilter.java:146)
at org.springframework.security.ui.SpringSecurityFilt er.doFilter(SpringSecurityFilter.java:53)
at org.springframework.security.util.FilterChainProxy $VirtualFilterChain.doFilter(FilterChainProxy.java :390)
at org.springframework.security.util.FilterChainProxy .doFilter(FilterChainProxy.java:175)
at org.springframework.web.filter.DelegatingFilterPro xy.invokeDelegate(DelegatingFilterProxy.java:238)
25more
org.apache.coyote.http11.Http11AprProtocol$Http11C onnectionHandler.process(Http11AprProtocol.java:56 5)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509)
at java.lang.Thread.run(Unknown Source)
什麼問題在上面的代碼和新代碼將是什麼。我是新的春天所以面臨的問題
Try:class StockData implements Serializable – nidhin 2012-02-09 14:27:26
已經使用過: – Aritra 2012-02-09 14:36:24