Class MyBatisLoader

java.lang.Object
mocka.generator.orm.mybatis.MyBatisLoader
All Implemented Interfaces:
ORMLoader

@Component public class MyBatisLoader extends Object implements ORMLoader
Loads and parses MyBatis mapper XML files to discover entity classes and their relationships. This loader scans MyBatis mapper XML files to extract entity metadata including:
  • Entity classes mapped in <resultMap> elements
  • Field mappings from <id> and <result> elements
  • Association relationships from <association> elements
  • Collection relationships from <collection> elements

Parsing Process:

  1. Resolves mapper XML resources from configured location pattern
  2. First pass: Parses basic fields (id and result elements)
  3. Second pass: Parses associations and collections (requires classes from first pass)
  4. Infers association types (one-to-one, many-to-one, one-to-many, many-to-many)
  5. Stores all metadata in MyBatisMetadata

Configuration:

The mapper location can be configured via Spring property:
 mocka:
   orm:
      mybatis:
         location: classpath*:mapper/**/*.xml  # default
 
  • Constructor Details

  • Method Details