это мое первое приложение mybatis spring mvc с использованием spring 3.2.4, mybatis- spring -1.2.1
Когда я пытаюсь вызвать свой веб-сервис, я получаю сообщение об ошибке::
org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is org.apache.ibatis.binding.BindingException: Invalid bound
statement (not found):
org.mydomain.formulary.drugmaster.dao.DrugMasterDao.getDrugsWithAlert
Я должен упустить что-то очевидное. Спасибо за любую помощь
Вот мои связанные файлы: applicationContext.xml
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="formularyDb" />
<property name="configLocation" value="file:/web/sites/drugformulary-spring/config/mybatis-config.xml" />
</bean>
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="org.mydomain.formulary.mappers" />
</bean>
<bean id="DrugMasterDao" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="org.mydomain.formulary.drugmaster.dao.DrugMasterDao" />
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
<constructor-arg index="0" ref="sqlSessionFactory" />
</bean>
mapper file → /classes/org/mydomain/formulary/mappers/drugmasterDao.xml
<mapper namespace="org.mydomain.formulary.drugmaster.dao.DrugMasterDao">
<select id="getDrugsWithAlert" parameterType="int" resultType="org.mydomain.formulary.drug_master.model.DrugMasters">
Select drug_id,drug_name,drug_alert_date,drug_alert_source, rownum
from (select drug_id,drug_name,to_char(drug_alert_datetime,'MM/DD/YYYY') as drug_alert_date ,drug_alert_source, rownum
from drug_master
where drug_status ='A' and length(drug_alert) > 0
order by drug_alert_datetime DESC )
where
<if test="_parameter != null">
rownum < #{count}
</if>
</select>
</mapper>
mapper file → /classes/org/mydomain/formulary/drugmaster/dao/DrugMasterDao.java
public interface DrugMasterDao {
public List<DrugMasters> getDrugsWithAlert(int count);
}
файл контроллера → /classes/org/mydomain/formulary/drugmaster/controller/DrugMasterController.java
@Controller
public class DrugMasterController {
@Autowired
DrugMasterService drugMasterService;
@RequestMapping(value = "/drugmaster/withalerts/count/{count}", method = RequestMethod.GET)
public String withAlerts(ModelMap model, @PathVariable int count) {
List<DrugMasters> drugs = drugMasterService.getDrugsWithAlert(count);
return null/*for now*/;
}
}
служебный файл → /classes/org/mydomain/formulary/drugmaster/service/DrugMasterServiceImpl.java
@Service
public class DrugMasterServiceImpl implements DrugMasterService {
@Autowired
DrugMasterDao drugMasterDao;
public List<DrugMasters> getDrugsWithAlert(int count){
return drugMasterDao.getDrugsWithAlert(count);
}
}
mybatis-configfile →
<configuration>
<settings>
<setting name="cacheEnabled" value="false" />
<setting name="lazyLoadingEnabled" value="false" />
</settings>
</configuration>