java - Mybatis <bind> tag cause SAXParseException -
i'm using mybatis in app. i'm using bind tag in select element. mapper code:
<?xml version="1.0" encoding="utf-8" ?> <!doctype mapper public "-//mybatis.org//dtd mapper 3.0//en" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="myapp.model.mydao"> <select id="myselect" parametertype="myapp.model.myparameterbean" resulttype="hashmap"> <bind name="sl" value="_parameter.getselectlist()" /> <bind name="tns" value="_parameter.gettablenamesuffix()" /> select name #{sl} mytable_#{tns} </select> </mapper>
when try compile app, saxparseexception. detailed error message is:
failed parse mapping resource: 'file [c:\myapp\model\mymapper.xml]'; nested exception org.apache.ibatis.builder.builderexception: error creating document instance. cause: org.xml.sax.saxparseexception: element type "bind" must declared. have idea bahaviour?
i'm using spring-mvc. spring-mybatis integration included mybatis-spring-1.1.0.jar.
hi all!
in case dynamic.select list or table name suffix depends on parameters.
<?xml version="1.0" encoding="utf-8" ?> <!doctype mapper public "-//mybatis.org//dtd mapper 3.0//en" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="myapp.model.mydao"> <select id="myselect" parametertype="myapp.model.myparameterbean" resulttype="hashmap"> <bind name="sl" value="_parameter.getselectlist()" /> <bind name="tns" value="_parameter.gettablenamesuffix()" /> select name #{sl} mytable_#{tns} </select> </mapper>
Comments
Post a Comment