Example usage for org.apache.ibatis.mapping FetchType LAZY

List of usage examples for org.apache.ibatis.mapping FetchType LAZY

Introduction

In this page you can find the example usage for org.apache.ibatis.mapping FetchType LAZY.

Prototype

FetchType LAZY

To view the source code for org.apache.ibatis.mapping FetchType LAZY.

Click Source Link

Usage

From source file:com.baomidou.mybatisplus.MybatisMapperAnnotationBuilder.java

License:Apache License

private boolean isLazy(Result result) {
    boolean isLazy = configuration.isLazyLoadingEnabled();
    if (result.one().select().length() > 0 && FetchType.DEFAULT != result.one().fetchType()) {
        isLazy = (result.one().fetchType() == FetchType.LAZY);
    } else if (result.many().select().length() > 0 && FetchType.DEFAULT != result.many().fetchType()) {
        isLazy = (result.many().fetchType() == FetchType.LAZY);
    }//from   ww w.  j  a  va2  s.c om
    return isLazy;
}

From source file:su90.mybatisdemo.dao.mapper.CountriesMapper.java

@Select("select * from countries")
@Results(value = { @Result(property = "id", column = "country_id"),
        @Result(property = "name", column = "country_name"),
        @Result(property = "region", column = "region_id", javaType = Region.class, one = @One(select = "su90.mybatisdemo.dao.mapper.RegionsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/*from w  ww .j a  va 2 s.c  om*/
List<Country> findAll();

From source file:su90.mybatisdemo.dao.mapper.CountriesMapper.java

@Select("select * from countries where country_id = #{id}")
@Results(value = { @Result(property = "id", column = "country_id"),
        @Result(property = "name", column = "country_name"),
        @Result(property = "region", column = "region_id", javaType = Region.class, one = @One(select = "su90.mybatisdemo.dao.mapper.RegionsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/*from www  . j  a v a  2s.  c om*/
Country findById(String id);

From source file:su90.mybatisdemo.dao.mapper.CountriesMapper.java

@SelectProvider(type = SqlBuilderHelper.class, method = "buildFindByRawProperties")
@Results(value = { @Result(property = "id", column = "country_id"),
        @Result(property = "name", column = "country_name"),
        @Result(property = "region", column = "region_id", javaType = Region.class, one = @One(select = "su90.mybatisdemo.dao.mapper.RegionsMapper.findById", fetchType = FetchType.LAZY)) })
@Override//from   w w w  .j  a va2s .  c  o  m
List<Country> findByRawProperties(Country country);

From source file:su90.mybatisdemo.dao.mapper.CountriesMapper.java

@SelectProvider(type = SqlBuilderHelper.class, method = "buildFindByRawType")
@Results(value = { @Result(property = "id", column = "country_id"),
        @Result(property = "name", column = "country_name"),
        @Result(property = "region", column = "region_id", javaType = Region.class, one = @One(select = "su90.mybatisdemo.dao.mapper.RegionsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/*  w  w  w .  j ava2 s  .co  m*/
public List<Country> findByRawType(Country country);

From source file:su90.mybatisdemo.dao.mapper.DepartmentsMapper.java

@Select("select * from departments")
@Results(value = { @Result(property = "id", column = "department_id"),
        @Result(property = "name", column = "department_name"),
        @Result(property = "manager", column = "manager_id", one = @One(select = "su90.mybatisdemo.dao.mapper.EmployeesMapper.findById", fetchType = FetchType.LAZY)),
        @Result(property = "location", column = "location_id", one = @One(select = "su90.mybatisdemo.dao.mapper.LocationsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/*from www . j ava2  s .  c  om*/
List<Department> findAll();

From source file:su90.mybatisdemo.dao.mapper.DepartmentsMapper.java

@Select("select * from departments where department_id = #{id}")
@Results(value = { @Result(property = "id", column = "department_id"),
        @Result(property = "name", column = "department_name"),
        @Result(property = "manager", column = "manager_id", one = @One(select = "su90.mybatisdemo.dao.mapper.EmployeesMapper.findById", fetchType = FetchType.LAZY)),
        @Result(property = "location", column = "location_id", one = @One(select = "su90.mybatisdemo.dao.mapper.LocationsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/*  w w w. ja v  a  2s .c o m*/
Department findById(Long id);

From source file:su90.mybatisdemo.dao.mapper.DepartmentsMapper.java

@SelectProvider(type = SqlBuilderHelper.class, method = "buildFindByRawType")
@Results(value = { @Result(property = "id", column = "department_id"),
        @Result(property = "name", column = "department_name"),
        @Result(property = "manager", column = "manager_id", one = @One(select = "su90.mybatisdemo.dao.mapper.EmployeesMapper.findById", fetchType = FetchType.LAZY)),
        @Result(property = "location", column = "location_id", one = @One(select = "su90.mybatisdemo.dao.mapper.LocationsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/*from  w w w . j  av  a 2s. co  m*/
public List<Department> findByRawType(Department bean);

From source file:su90.mybatisdemo.dao.mapper.DepartmentsMapper.java

@SelectProvider(type = SqlBuilderHelper.class, method = "buildFindByRawProperties")
@Results(value = { @Result(property = "id", column = "department_id"),
        @Result(property = "name", column = "department_name"),
        @Result(property = "manager", column = "manager_id", one = @One(select = "su90.mybatisdemo.dao.mapper.EmployeesMapper.findById", fetchType = FetchType.LAZY)),
        @Result(property = "location", column = "location_id", one = @One(select = "su90.mybatisdemo.dao.mapper.LocationsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/* w ww.  j av  a2 s .  c  o  m*/
public List<Department> findByRawProperties(Department bean);

From source file:su90.mybatisdemo.dao.mapper.EmployeesMapper.java

@Select("select * from employees")
@Results(value = { @Result(property = "id", column = "employee_id"),
        @Result(property = "fname", column = "first_name"), @Result(property = "lname", column = "last_name"),
        @Result(property = "email", column = "email"), @Result(property = "phone", column = "phone_number"),
        @Result(property = "hiredate", column = "hire_date"),
        @Result(property = "job", column = "job_id", javaType = Job.class, one = @One(select = "su90.mybatisdemo.dao.mapper.JobsMapper.findById", fetchType = FetchType.LAZY)),
        @Result(property = "salary", column = "salary"), @Result(property = "comm", column = "commission_pct"),
        @Result(property = "manager", column = "manager_id", one = @One(select = "su90.mybatisdemo.dao.mapper.EmployeesMapper.findById", fetchType = FetchType.LAZY)),
        @Result(property = "department", column = "department_id", one = @One(select = "su90.mybatisdemo.dao.mapper.DepartmentsMapper.findById", fetchType = FetchType.LAZY)) })
@Override/*from   w w w . j a v  a2  s .  co m*/
List<Employee> findAll();