All Downloads are FREE. Search and download functionalities are using the official Maven repository.

wiki.xsx.jg.core.DatabaseService Maven / Gradle / Ivy

Go to download

a generator, from the database tables convert to the Java classes or from the Java classes convert to the database tables. support mysql, oracle and sqlserver.

There is a newer version: 1.2.1
Show newest version
package wiki.xsx.jg.core;

import java.util.Set;

/**
 * 数据库服务接口
 */
public interface DatabaseService {

    /**
     * 设置数据表字段及类型
     * @throws Exception 异常信息
     */
    void setTableInfo() throws Exception;

    /**
     * 根据数据表对象集合创建数据表
     * @param tableSet 数据表对象集合
     * @throws Exception 异常信息
     */
    void createTables(Set tableSet) throws Exception;

    /**
     * 获取数据库对象
     * @return 返回数据库对象
     */
    Database getDatabase();

    /**
     * 根据数据库类型获取对应的Java类型
     * @param dataTypeName 数据库类型
     * @param length 数据长度
     * @param scale 小数位数
     * @return 返回对应类型的class对象
     */
    Class getTypeClass(String dataTypeName, int length, int scale);

    /**
     * 根据Java类型获取数据库中数据类型
     * @param type 类对象
     * @return 返回数据库中数据类型字符串
     */
    String getDataType(Class type);

    /**
     * 根据类名称获取表的删除语句
     * @param className 类名称
     * @return 返回sql语句
     */
    String getDropTableSQL(String className);

    /**
     * 根据数据库表对象获取表的创建语句
     * @param table 数据库表对象
     * @return 返回sql语句
     */
    String getCreateTableSQL(Table table);
}