Skip to content

Code Generator

zzg edited this page Mar 31, 2017 · 39 revisions

Code generator

Java Build

@DB(url="jdbc:mysql://",username="root",  password="root")
public interface TestDB {        
    public static DBConfig DB=DBConfig.fromClass(TestDB.class);
    public static class Generate{        
      public static void main(String[] args) { 
          //Generate Model classes to directory: src/main/java OR src  

Maven Build


Eclipse Plugin

Drag to your running Eclipse workspace to install monalisa-orm


  • Download plugin ,Place the jar to : eclipse/plugins
  • Restart Eclipse

Plugin source code

Auto-generate model classes (Saved: Ctrl+S)

  • Need to set up project(Properties->Java Compiler)

    JDK compliance: >= 1.6

  • Need to set up project(Properties->Java Compiler->Annotation Processing)

    Enable this option: Enable annotation processing

Like this:


Auto-Generate DTOs

  • Need to set up eclipse (Window->Preferences->Java->Editor->Save Action -> Configure -> monalisa)

    Enable this option: @Select

Like this:


Multiline String

Plugin installed, you can write multiline strings. For detail: Multiline Syntax

Effect as shown below:


You can’t perform that action at this time.