AnsweredAssumed Answered

Mybatis in java-backed webscript

Question asked by zucco1411 on Jul 15, 2018

Hi i'm using Alfresco community edition. I'm trying to integrate mybatis in an alfresco java-backed webscript (with spring-mvc framework). but my project throws an exception java.lang.NullPointerException.

Here my configuration:

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">  <property name="dataSource" ref="dataSourceMySql" /></bean><bean id="ppackMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">  <property name="mapperInterface" value="com.clm.MyBatis.PpackMapper" />  <property name="sqlSessionFactory" ref="sqlSessionFactory" /></bean>

My mapper:

public interface PpackMapper {public List<Ppack> getCentoPack();@Select("SELECT * FROM ppack LIMIT 100")public List<Ppack> selectAllPack2();}

I've called in a class in my project my query:

@Autowired private PpackMapper ppackMapper;@RequestMapping public void tryMybatis() {    List<Ppack> ppackcento = this.ppackMapper.selectAllPack2();

here my webscript throw an java.lang.NullPointerException.

Outcomes