日期:2014-05-17  浏览次数:20752 次

mybatis的报错……ORA-00911: 无效字符
xml里的配置

<select id="findLocalPeopleSfzh" parameterType="com.tzyt.common.model.PageMap"
    resultType="java.lang.String">
    select t.sfzh from t_ldrk t 
<trim prefix="where" prefixOverrides="and|or">
     <if test="condition  != null and condition.differDay  != null">
    and t.djrq > (sysdate - #{condition.differDay}) 
      </if>
    and t.djrq 
    <![CDATA[ < ]]> 
    sysdate;
    </trim>
  </select>

运行报错:

org.springframework.jdbc.BadSqlGrammarException
### Error querying database.  Cause: java.sql.SQLException: ORA-00911: 无效字符

### The error may involve com.tzyt.people.dao.PeopleMapper.findLocalPeopleSfzh-Inline
### The error occurred while setting parameters
### Cause: java.sql.SQLException: ORA-00911: 无效字符

; bad SQL grammar []; nested exception is java.sql.SQLException: ORA-00911: 无效字符

at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:98)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:346)
at $Proxy9.selectList(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:189)
at org.apache.ibatis.binding.MapperMethod.executeForList(MapperMethod.java:100)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:70)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:38)
at $Proxy25.findLocalPeopleSfzh(Unknown Source)
at com.tzyt.people.service.impl.PeopleServiceImpl.findLocalPeopleSfzh(PeopleServiceImpl.java:1036)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.