简体   繁体   中英

Using nested interfaces and mapper with MyBatis

Is it possible to use nested mapper interface?:

package com.sample.package;

public class SampleService{

  public interface SampleMapper{
    public List<MyEntity> selectAllEntities();
  }
}

And if yes:

  • where to put mapper xml file?
  • what should be the name of xml file?
  • what namespace shoud I put in mapper xml file for interface?

It works.

  • The name of mapper must be SampleService$SampleMapper.xml.
  • It must be placed in the SampleService dir.
  • Namespace is com.sample.package.SampleService$SampleMapper.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM