demo_opoa.jsp?easyList=userInfoList页面出错(数据库换成了sqlserver)

s1good 2007-05-27
修改:applicationContext.xml
<bean id="test_datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver" />
<property name="url">
<value>jdbc:jtds:sqlserver://localhost:1433/ec</value>
</property>
<property name="username" value="sa" />
<property name="password" value="*******" />
</bean>

demo_opoa.jsp?easyList=userInfoList页面出错,错误:
2007-5-27 20:57:38 org.ecside.common.log.LogHandler errorLog
严重: java.sql.SQLException: 第 1 行: '@P0' 附近有语法错误。
at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:365)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:418)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:693)
at org.ecside.easyda.DataAccessModel.executeQuery(DataAccessModel.java:144)
at org.ecside.easyda.DataAccessModel.executeQuery(DataAccessModel.java:113)
at org.ecside.easylist.AbstractEasyListModel.getRecordsList(AbstractEasyListModel.java:52)
at org.ecside.easylist.EasyDataAccessHandler.easyList(EasyDataAccessHandler.java:71)
at org.ecside.filter.ECSideFilter.doFilter(ECSideFilter.java:169)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:595)
s1good 2007-05-27
applicationContext.xml
修改了数据库SQL语句修改!
不知道问题出在这里不,反正能显示不报错了?
发现新得问题:
模糊查询不能实现?
select  * from user_info
where 1=1
#{IF:USERNAME!=EMPTY} and username like '%#{USERNAME}%' #{/IF}
//问题在这里加了'%%'和没加都不能正常模糊查询!
#{IF:PASSWD!=EMPTY} and passwd=#{PASSWD} #{/IF}
#{IF:USERROLE!=EMPTY} and userrole=#{USERROLE} #{/IF}
#{IF:GENDER!=EMPTY} and gender=#{GENDER} #{/IF}
希望知道得朋友能热心教我谢谢!
还有希望能出FAQ!刚接触没FAQ遇到问题满棘手得
fins 2007-05-28
1 换数据库sql也要做一些修改.
毕竟这个只是一个简单的sql mapping 而不是 orm之类的

2 支持模糊查询,但是不是像你那么做的
#{USERNAME}是一个整体

如果你需要模糊查询,你需要做的是 让#{USERNAME}的值里含有%

你可以继承 DefaultEasyListModel 写一个自己的实现来实现这个功能

详细请看 MyEasyListDemo.java
s1good 2007-05-28
谢谢fins
Global site tag (gtag.js) - Google Analytics