Appreciate your help
correct, that is i figure it out fixed the code ,but some how not gets
the Mapper reference in fixedIncomeDAOImpl.it;s just throw null
pointer. i am using mybatis-spring-1.0.1-SNAPSHOT.jar and
mybatis-3.0.5-SNAPSHOT.jar
(return fixedIncomeMapper.getTimeToMaturiy() never works )
public class FixedIncomeDAOImpl implements FixedIncomeDAO {
protected Logger logger =
LoggerFactory.getLogger(FixedIncomeDAOImpl.class);
@Autowired
private FixedIncomeMapper fixedIncomeMapper;
public FixedIncomeMapper getFixedIncomeMapper() {
return fixedIncomeMapper;
}
public void setFixedIncomeMapper(FixedIncomeMapper fixedIncomeMapper)
{
this.fixedIncomeMapper = fixedIncomeMapper;
}
@SuppressWarnings("unchecked")
public List<CcyDenomination> getTimeToMaturiy(double req){
try {
return fixedIncomeMapper.getTimeToMaturiy();
} catch (Exception ex) {
logger.error("SQL error, while running - getccydenom ", ex);
}
return null;
}
}
lvfi-data.xml
<bean id="sqlSessionFactory"
class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="creditDataSource" />
<property name="configLocation" value="classpath:mybatis/Mybatis-
Config.xml" />
</bean>
<bean id="fixedIncomeMapper"
class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface"
value="com.jpmorgan.pb.credit.mybatis.model.FixedIncomeMapper" />
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<bean id="fixedIncomeDAO"
class="com.jpmorgan.pb.credit.mybatis.dao.FixedIncomeDAOImpl">
<property name="fixedIncomeMapper" ref="fixedIncomeMapper" />
</bean>
FixedIncomeMapper.java
public interface FixedIncomeMapper {
public List<CcyDenomination> getTimeToMaturiy();
}
FixedIncomeMapper.xml
<mapper
namespace="com.jpmorgan.pb.credit.mybatis.model.FixedIncomeMapper">
<resultMap id="ccydenomrs" resultType="ccydenom">
<result property="ccydenomination" column="Currency_denominated"/>
</resultMap>
<select id="getTimeToMaturiy" resultMap="ccydenomrs"
statementType="CALLABLE">
{call dbo.get_fxd_incm_currency_grid()}
</select>
</mapper>