美文网首页
modeldb jooq generate the java c

modeldb jooq generate the java c

作者: Helen_Cat | 来源:发表于2018-09-01 11:36 被阅读50次

    cd mysql
    wget mysql-connector-java-8.0.12.jar
    vi library.xml
    cd codegen

    java -classpath jars/jooq-3.8.4.jar:jars/jooq-meta-3.8.4.jar:jars/jooq-codegen-3.8.4.jar:mysql/mysql-connector-java-8.0.12.jar:. org.jooq.util.GenerationTool mysql/library.xml

    原来的是生成java 代码 ,修改一下 <generator> <name> 为org.jooq.util.ScalaGenerator
    就可以生成 scala 代码

    library.xml

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <configuration>
      <jdbc>
        <driver>com.mysql.cj.jdbc.Driver</driver>
        <url>jdbc:mysql://localhost:3306/modeldb?useUnicode=true&amp;characterEncoding=utf8&amp;autoReconnect=true&amp;rewriteBatchedStatements=TRUE&amp;useSSL=false&amp;serverTimezone=UTC</url>
        <user>muller</user>
        <password>7104</password>
        <database>modeldb</database>
      </jdbc>
    
      <generator>
        <database>
                 <name>org.jooq.util.JavaGenerator</name>
        <!--<name>org.jooq.util.ScalaGenerator</name>  generate scala code -->
          <!-- The database dialect from jooq-meta. Available dialects are
               named org.util.[database].[database]Database. Known values are:
    
               org.jooq.util.ase.ASEDatabase (to be used with Sybase ASE)
               org.jooq.util.cubrid.CUBRIDDatabase
               org.jooq.util.db2.DB2Database
               org.jooq.util.derby.DerbyDatabase
               org.jooq.util.h2.H2Database
               org.jooq.util.hsqldb.HSQLDBDatabase
               org.jooq.util.ingres.IngresDatabase
               org.jooq.util.mysql.MySQLDatabase
               org.jooq.util.oracle.OracleDatabase
               org.jooq.util.postgres.PostgresDatabase
               org.jooq.util.sqlite.SQLiteDatabase
               org.jooq.util.sqlserver.SQLServerDatabase
               org.jooq.util.sybase.SybaseDatabase (to be used with Sybase SQL Anywhere)
    
               You can also provide your own org.jooq.util.Database implementation
               here, if your database is currently not supported or if you wish to
               read the database schema from a file, such as a Hibernate .hbm.xml file -->
          <name>org.jooq.util.mysql.MySQLDatabase </name>
    
          <!-- All elements that are generated from your schema (several Java
               regular expressions, separated by comma) Watch out for
               case-sensitivity. Depending on your database, this might be
               important! You can create case-insensitive regular expressions
               using this syntax: (?i:expr)A comma-separated list of regular
               expressions -->
          <includes>.*</includes>
    
          <!-- All elements that are excluded from your schema (several Java
               regular expressions, separated by comma). Excludes match before
               includes -->
          <excludes></excludes>
    
          <!-- The schema that is used locally as a source for meta information.
               This could be your development schema or the production schema, etc
               This cannot be combined with the schemata element.
    
               If left empty, jOOQ will generate all available schemata. See the
               manual'second next section to learn how to generate several schemata -->
          <inputSchema>modeldb</inputSchema>
        </database>
    
        <generate>
          <!-- Generation flags: See advanced configuration properties -->
        </generate>
    
        <target>
          <!-- The destination package of your generated classes (within the
               destination directory) -->
          <packageName>jooq.mysql.gen</packageName>
    
          <!-- The destination directory of your generated classes -->
          <directory>../src/main/java</directory>
        </target>
        <generate>
          <pojos>true</pojos>
          <daos>true</daos>
          <deprecated>false</deprecated>
        </generate>
      </generator>
    </configuration>
    

    相关文章

      网友评论

          本文标题:modeldb jooq generate the java c

          本文链接:https://www.haomeiwen.com/subject/shoywftx.html