⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 辅助产生DAO类的工具
💻 TXT
字号:
---------------
  DAO4J v1.00
---------------

INTRODUCTION
------------
    Welcome using DAO4J. DAO4J is a free DAO Generator for Java. 
    
    DAO4J can generete clear and efficient Java source files to populate Database tables via standard JDBC.
    
    Currently, DAO4J doesn't support relationships among tables because I believe that the mapping 
    between one DTO Class and one DB table is enough for DAO layer in most J2EE projects. 
    The business layer often use and coordinate the activities of multiple Dao Access Objects, and may 
    provides transaction services if necessary.
    
REQUIREMENTS
------------
The Java 2 SDK is required to run DAO4J.

USAGE
-----
1. Define table schema
    Prepare a plain text file which defines the table schema for which you want to 
    generate DAO java source files. 
    
    The file should contains 3 columns:
        fieldName, dbDataType, primaryKey
        
        fieldName  : the name of the table field.
        dbDataType : the data types which your database used.
        primaryKey : 1 or pk means PK, 0 means non-PK.
        
    For example:
        
        order_no        int            1
        order_type      smallint       1
        order_date      datetime       0
        value           numeric        0
        
2. Define type mappings
    Prepare a plain text file which defines the mappings between dbDataTypes and javaDataTypes.
    
    Syntax is dbDataTypes=javaDataTypes
    
    For example:

        bit=boolean
        tinyint=byte
        smallint=Short
        int=int
        real=float
        float=float
        double=double
        numeric=java.math.BigDecimal
        decimal=java.math.BigDecimal
        money=java.math.BigDecimal
        char=String
        varchar=String
        longvarchar=String
        text=String
        binary=byte[]
        varbinary=byte[]
        image=byte[]
        datetime=java.util.Date
        smalldatetime=java.sql.Timestamp
        timestamp=java.sql.Timestamp
    
    Note: dbDataTypes MUST NOT contains white spaces, otherwise DAO4J will throw an Exception.
          For more informations about valid Java Data Types which are supported by DAO4J, 
          please refer to APPENDIX  --  Supported Java Data Types.

3. Run DAO4J to generate DAO java source files
    java -jar dao4j-1.00.jar [option]..

         -c,--class        Specify the Class name for genarated Javabeans. It will
                           be guessed by tableName if not specified
         -d                Specify where to place the generated files. Default
                           value is current workdir
         -h,--help         Print this help message
         -i,--in           Required. Specify the input file which contains table
                           schema
         -m,--mapping      Required. Specify the name of typeMappinf file
         -p,--package      Required. Specify the package name for genarated Java
                           source files
         -t,--tableName    Required. Specify the table name
    
    For example:
        
        java hlg.zhaoliang.dao4j.Main \
            -d source \
            --in table.def \
            --tableName business_order \
            --mapping conf\\DBTypeMapping.properties  \
            --class Order \ 
            --package com.company.project
        
        which will generate the following java source files:
            source\com\company\project\Order.java
                -- This is the DTO Class
            source\com\company\project\OrderKey.java
                -- The DTO Class which contains only the PK fields and can be used as the key of HashMap
            source\com\company\project\dao\OrderDAO.java
                -- The DAO interface
            source\com\company\project\orm\OrderDAOImpl.java
                -- The DAO Impl Class

APPENDIX  --  Supported Java Data Types
-------------------------------------------
        Primary Type:
                        boolean
                        byte
                        byte[]
                        short
                        int
                        long
                        float
                        double
        
        Wrapper Classes:
                        Boolean
                        Byte
                        Short
                        Integer
                        Long   
                        Short
                        Double
                        String
        
        Other Classes:
                        java.math.BigDecimal
                        java.sql.Array
                        java.sql.Blob
                        java.sql.Clob
                        java.sql.Date
                        java.sql.Ref
                        java.sql.Struct
                        java.sql.Time
                        java.sql.Timestamp
                        java.util.Date

    Note:
        The Wrapper Classes which are in java.lang package MUST NOT have package name.
        Other Classes MUST have package names;
        
LIBRARYS
--------
    The jar file which has all dependent classes is under ${DAO4J}\lib, please add the it 
    to the classpath before you run DAO4J.
        
        UNIX:
            $classpath=dao4j-dev-1.00.jar:$classpath
            export $classpath
        WINDOWS:
            set classpath=dao4j-dev-1.00.jar;%classpath%
    
    Run DAO4J:
        
        java hlg.zhaoliang.dao4j.Main
      
    Or you can run DAO4J like this:
    
        java -jar dao4j-dev-1.00.jar [option]...

    Note: 
        This product includes software developed by the Apache Software Foundation (http://www.apache.org/).
        For more information on the Apache Software Foundation, please see <http://www.apache.org/>.

CONTACTS
--------
    If you find bugs or have any comments about DAO4J, please send emails to 
        
        b-i-d@163.com
    
    Your comments are very valuable to improve DAO4J.
    
    Thank you!   

Zhao Liang
hlg, Beijing, China
9/8/2004

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -