package sample.activerecord.bean;

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Method;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import rubbish.db.Database;
import rubbish.db.Handler;
import rubbish.db.MapHandler;
import rubbish.db.ar.ActiveRecord;
import rubbish.db.ar.JoinedActiveRecord;
import rubbish.db.ar.JoinedActiveRecordM;
import rubbish.db.ar.condition.Column;
import rubbish.db.ar.condition.Condition;
import rubbish.db.ar.condition.ConditionWHERE;
import rubbish.db.ar.trigger.Trigger;
import rubbish.db.exception.SQLRuntimeException;
import rubbish.db.manager.DatabaseManager;
import rubbish.db.util.BeanWrapper;
import rubbish.db.util.array.ArrayUtils;

public class Book extends ActiveRecord {

    public static void addTrigger(Trigger trigger) {
        addTrigger(Book.class, trigger);
    }

    public static void clearTrigger() {
        clearTrigger(Book.class);
    }

    //---------------------------------------------------------------

    public static Book findByPK(String id, String publisher) throws SQLRuntimeException {
        Database __dbh__ = DatabaseManager.getDatabase();
        Object[] __params__ = { id, publisher };
        return (Book) __dbh__.selectRow(Book.class, "ID = ? AND PUBLISHER = ?", __params__);
    }

    public static int updateByPK(String id, String publisher, Map set) throws SQLRuntimeException {
        Database __dbh__ = DatabaseManager.getDatabase();
        Object[] __params__ = { id, publisher };
        return __dbh__.updateBy(Book.class, "ID = ? AND PUBLISHER = ?", __params__, set);
    }

    public static int updateByPK(String id, String publisher, MapHandler handler) throws SQLRuntimeException {
        Database __dbh__ = DatabaseManager.getDatabase();
        Object[] __params__ = { id, publisher };
        return __dbh__.updateBy(Book.class, "ID = ? AND PUBLISHER = ?", __params__, handler);
    }

    public static int deleteByPK(String id, String publisher) throws SQLRuntimeException {
        Database __dbh__ = DatabaseManager.getDatabase();
        Object[] __params__ = { id, publisher };
        return __dbh__.deleteBy(Book.class, "ID = ? AND PUBLISHER = ?", __params__);
    }

    //---------------------------------------------------------------

    public String serializeByPK() {
        try {
            StringBuffer __identifier__ = new StringBuffer();
            __identifier__.append("id:" + URLEncoder.encode(getId().toString(), "UTF-8"));
            __identifier__.append(",");
            __identifier__.append("publisher:" + URLEncoder.encode(getPublisher().toString(), "UTF-8"));
            return __identifier__.toString();
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

    public static Book deserializeByPK(String __identifier__) {
        try {
            Map conditions = new HashMap();
            String[] col_vals = __identifier__.split(",");

            for (int i = 0; i < col_vals.length; i++) {
                String[] col_val = col_vals[i].split(":");
                conditions.put(col_val[0], URLDecoder.decode(col_val[1], "UTF-8"));
            }

            return Book.find(conditions);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

    //---------------------------------------------------------------

    public static Book find() throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRow(Book.class);
    }

    public static Book find(CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRow(Book.class, where);
    }

    public static Book find(CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRow(Book.class, where, param1);
    }

    public static Book find(CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRow(Book.class, where, param1, param2);
    }

    public static Book find(CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRow(Book.class, where, param1, param2, param3);
    }

    public static Book find(CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRow(Book.class, where, params);
    }

    public static Book find(Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRow(new ConditionWHERE(Book.class, condition));
    }

    public static Book find(Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRowBy(Book.class, conditions);
    }

    public static Book find(MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book) dbh.selectRowBy(Book.class, handler);
    }

    //---------------------------------------------------------------

    public static Book[] findAny() throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class);
    }

    public static Book[] findAny(CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where);
    }

    public static Book[] findAny(CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, param1);
    }

    public static Book[] findAny(CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, param1, param2);
    }

    public static Book[] findAny(CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, param1, param2, param3);
    }

    public static Book[] findAny(CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, params);
    }

    public static Book[] findAny(Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(new ConditionWHERE(Book.class, condition));
    }

    public static Book[] findAny(Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.selectBy(Book.class, conditions);
    }

    public static Book[] findAny(MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.selectBy(Book.class, handler);
    }

    //---------------------------------------------------------------

    public static Book[] findAny(int start, int lines) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, start, lines);
    }

    public static Book[] findAny(CharSequence where, int start, int lines) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, start, lines);
    }

    public static Book[] findAny(CharSequence where, int start, int lines, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, start, lines, param1);
    }

    public static Book[] findAny(CharSequence where, int start, int lines, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, start, lines, param1, param2);
    }

    public static Book[] findAny(CharSequence where, int start, int lines, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, start, lines, param1, param2, param3);
    }

    public static Book[] findAny(CharSequence where, int start, int lines, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(Book.class, where, start, lines, params);
    }

    public static Book[] findAny(Condition condition, int start, int lines) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.select(new ConditionWHERE(Book.class, condition), start, lines);
    }

    public static Book[] findAny(Map conditions, int start, int lines) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.selectBy(Book.class, conditions, start, lines);
    }

    public static Book[] findAny(int start, int lines, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return (Book[]) dbh.selectBy(Book.class, start, lines, handler);
    }

    //---------------------------------------------------------------

    public static void findAny(Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, handler);
    }

    public static void findAny(CharSequence where, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, handler);
    }

    public static void findAny(CharSequence where, Object param1, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, param1, handler);
    }

    public static void findAny(CharSequence where, Object param1, Object param2, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, param1, param2, handler);
    }

    public static void findAny(CharSequence where, Object param1, Object param2, Object param3, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, param1, param2, param3, handler);
    }

    public static void findAny(CharSequence where, Object[] params, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, params, handler);
    }

    public static void findAny(Condition condition, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(new ConditionWHERE(Book.class, condition), handler);
    }

    public static void findAny(Map conditions, Object[] params, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.selectBy(Book.class, conditions, handler);
    }

    //---------------------------------------------------------------

    public static void findAny(int start, int lines, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, start, lines, handler);
    }

    public static void findAny(CharSequence where, int start, int lines, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, start, lines, handler);
    }

    public static void findAny(CharSequence where, int start, int lines, Object param1, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, start, lines, param1, handler);
    }

    public static void findAny(CharSequence where, int start, int lines, Object param1, Object param2, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, start, lines, param1, param2, handler);
    }

    public static void findAny(CharSequence where, int start, int lines, Object param1, Object param2, Object param3, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, start, lines, param1, param2, param3, handler);
    }

    public static void findAny(CharSequence where, int start, int lines, Object[] params, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(Book.class, where, start, lines, params, handler);
    }

    public static void findAny(Condition condition, int start, int lines, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.select(new ConditionWHERE(Book.class, condition), start, lines, handler);
    }

    public static void findAny(Map conditions, int start, int lines, Handler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        dbh.selectBy(Book.class, conditions, start, lines, handler);
    }

    //---------------------------------------------------------------

    public static int count() throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class);
    }

    public static int count(CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class, where);
    }

    public static int count(CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class, where, param1);
    }

    public static int count(CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class, where, param1, param2);
    }

    public static int count(CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class, where, param1, param2, param3);
    }

    public static int count(CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class, where, params);
    }

    public static int count(Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(new ConditionWHERE(Book.class, condition));
    }

    public static int count(Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class, conditions);
    }

    public static int count(MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.count(Book.class, handler);
    }

    //---------------------------------------------------------------

    public static Object avg(CharSequence column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column);
    }

    public static Object avg(CharSequence column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column, where);
    }

    public static Object avg(CharSequence column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column, where, param1);
    }

    public static Object avg(CharSequence column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column, where, param1, param2);
    }

    public static Object avg(CharSequence column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column, where, param1, param2, param3);
    }

    public static Object avg(CharSequence column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column, where, params);
    }

    public static Object avg(CharSequence column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(column, new ConditionWHERE(Book.class, condition));
    }

    public static Object avg(CharSequence column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column, conditions);
    }

    public static Object avg(CharSequence column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column, handler);
    }

    //---------------------------------------------------------------

    public static Object avg(Column column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN());
    }

    public static Object avg(Column column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN(), where);
    }

    public static Object avg(Column column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN(), where, param1);
    }

    public static Object avg(Column column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN(), where, param1, param2);
    }

    public static Object avg(Column column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN(), where, param1, param2, param3);
    }

    public static Object avg(Column column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN(), where, params);
    }

    public static Object avg(Column column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(column.getFQCN(), new ConditionWHERE(Book.class, condition));
    }

    public static Object avg(Column column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN(), conditions);
    }

    public static Object avg(Column column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.avg(Book.class, column.getFQCN(), handler);
    }

    //---------------------------------------------------------------

    public static Object max(CharSequence column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column);
    }

    public static Object max(CharSequence column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column, where);
    }

    public static Object max(CharSequence column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column, where, param1);
    }

    public static Object max(CharSequence column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column, where, param1, param2);
    }

    public static Object max(CharSequence column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column, where, param1, param2, param3);
    }

    public static Object max(CharSequence column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column, where, params);
    }

    public static Object max(CharSequence column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(column, new ConditionWHERE(Book.class, condition));
    }

    public static Object max(CharSequence column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column, conditions);
    }

    public static Object max(CharSequence column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column, handler);
    }

    //---------------------------------------------------------------

    public static Object max(Column column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN());
    }

    public static Object max(Column column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN(), where);
    }

    public static Object max(Column column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN(), where, param1);
    }

    public static Object max(Column column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN(), where, param1, param2);
    }

    public static Object max(Column column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN(), where, param1, param2, param3);
    }

    public static Object max(Column column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN(), where, params);
    }

    public static Object max(Column column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(column.getFQCN(), new ConditionWHERE(Book.class, condition));
    }

    public static Object max(Column column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN(), conditions);
    }

    public static Object max(Column column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.max(Book.class, column.getFQCN(), handler);
    }

    //---------------------------------------------------------------

    public static Object min(CharSequence column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column);
    }

    public static Object min(CharSequence column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column, where);
    }

    public static Object min(CharSequence column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column, where, param1);
    }

    public static Object min(CharSequence column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column, where, param1, param2);
    }

    public static Object min(CharSequence column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column, where, param1, param2, param3);
    }

    public static Object min(CharSequence column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column, where, params);
    }

    public static Object min(CharSequence column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(column, new ConditionWHERE(Book.class, condition));
    }

    public static Object min(CharSequence column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column, conditions);
    }

    public static Object min(CharSequence column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column, handler);
    }

    //---------------------------------------------------------------

    public static Object min(Column column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN());
    }

    public static Object min(Column column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN(), where);
    }

    public static Object min(Column column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN(), where, param1);
    }

    public static Object min(Column column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN(), where, param1, param2);
    }

    public static Object min(Column column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN(), where, param1, param2, param3);
    }

    public static Object min(Column column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN(), where, params);
    }

    public static Object min(Column column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(column.getFQCN(), new ConditionWHERE(Book.class, condition));
    }

    public static Object min(Column column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN(), conditions);
    }

    public static Object min(Column column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.min(Book.class, column.getFQCN(), handler);
    }

    //---------------------------------------------------------------

    public static Object sum(CharSequence column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column);
    }

    public static Object sum(CharSequence column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column, where);
    }

    public static Object sum(CharSequence column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column, where, param1);
    }

    public static Object sum(CharSequence column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column, where, param1, param2);
    }

    public static Object sum(CharSequence column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column, where, param1, param2, param3);
    }

    public static Object sum(CharSequence column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column, where, params);
    }

    public static Object sum(CharSequence column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(column, new ConditionWHERE(Book.class, condition));
    }

    public static Object sum(CharSequence column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column, conditions);
    }

    public static Object sum(CharSequence column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column, handler);
    }

    //---------------------------------------------------------------

    public static Object sum(Column column) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN());
    }

    public static Object sum(Column column, CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN(), where);
    }

    public static Object sum(Column column, CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN(), where, param1);
    }

    public static Object sum(Column column, CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN(), where, param1, param2);
    }

    public static Object sum(Column column, CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN(), where, param1, param2, param3);
    }

    public static Object sum(Column column, CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN(), where, params);
    }

    public static Object sum(Column column, Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(column.getFQCN(), new ConditionWHERE(Book.class, condition));
    }

    public static Object sum(Column column, Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN(), conditions);
    }

    public static Object sum(Column column, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.sum(Book.class, column.getFQCN(), handler);
    }

    //---------------------------------------------------------------

    public static int update(Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, set);
    }

    public static int update(CharSequence where, Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, set);
    }

    public static int update(CharSequence where, Object param1, Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, param1, set);
    }

    public static int update(CharSequence where, Object param1, Object param2, Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, param1, param2, set);
    }

    public static int update(CharSequence where, Object param1, Object param2, Object param3, Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, param1, param2, param3, set);
    }

    public static int update(CharSequence where, Object[] params, Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, params, set);
    }

    public static int update(Condition condition, Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(new ConditionWHERE(Book.class, condition), set);
    }

    public static int update(Map conditions, Map set) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, conditions, set);
    }

    //---------------------------------------------------------------

    public static int update(MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, handler);
    }

    public static int update(CharSequence where, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, handler);
    }

    public static int update(CharSequence where, Object param1, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, param1, handler);
    }

    public static int update(CharSequence where, Object param1, Object param2, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, param1, param2, handler);
    }

    public static int update(CharSequence where, Object param1, Object param2, Object param3, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, param1, param2, param3, handler);
    }

    public static int update(CharSequence where, Object[] params, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, params, handler);
    }

    public static int update(Condition condition, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(new ConditionWHERE(Book.class, condition), handler);
    }

    public static int update(Map conditions, MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, conditions, handler);
    }

    //---------------------------------------------------------------

    public static int update(Handler handler) throws SQLRuntimeException {
        return update(null, ArrayUtils.EMPTY_ARRAY, handler);
    }

    public static int update(CharSequence where, Handler handler) throws SQLRuntimeException {
        return update(where, ArrayUtils.EMPTY_ARRAY, handler);
    }

    public static int update(CharSequence where, Object param1, Handler handler) throws SQLRuntimeException {
        Object[] params = { param1 };
        return update(where, params, handler);
    }

    public static int update(CharSequence where, Object param1, Object param2, Handler handler) throws SQLRuntimeException {
        Object[] params = { param1, param2 };
        return update(where, params, handler);
    }

    public static int update(CharSequence where, Object param1, Object param2, Object param3, Handler handler) throws SQLRuntimeException {
        Object[] params = { param1, param2, param3 };
        return update(where, params, handler);
    }

    public static int update(CharSequence where, Object[] params, Handler handler) throws SQLRuntimeException {
        Method handleMethod = getBeanHandlerMethod(handler, Book.class);
        Book row = new Book();
        invokeBeanHandlerMethod(row, handler, handleMethod);

        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, where, params, row.__initvals__);
    }

    public static int update(Condition condition, Handler handler) throws SQLRuntimeException {
        Method handleMethod = getBeanHandlerMethod(handler, Book.class);
        Book row = new Book();
        invokeBeanHandlerMethod(row, handler, handleMethod);

        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(new ConditionWHERE(Book.class, condition), row.__initvals__);
    }

    public static int update(Map conditions, Handler handler) throws SQLRuntimeException {
        Method handleMethod = getBeanHandlerMethod(handler, Book.class);
        Book row = new Book();
        invokeBeanHandlerMethod(row, handler, handleMethod);

        Database dbh = DatabaseManager.getDatabase();
        return dbh.updateBy(Book.class, conditions, row.__initvals__);
    }

    //---------------------------------------------------------------

    public static int delete() throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class);
    }

    public static int delete(CharSequence where) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class, where);
    }

    public static int delete(CharSequence where, Object param1) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class, where, param1);
    }

    public static int delete(CharSequence where, Object param1, Object param2) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class, where, param1, param2);
    }

    public static int delete(CharSequence where, Object param1, Object param2, Object param3) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class, where, param1, param2, param3);
    }

    public static int delete(CharSequence where, Object[] params) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class, where, params);
    }

    public static int delete(Condition condition) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(new ConditionWHERE(Book.class, condition));
    }

    public static int delete(Map conditions) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class, conditions);
    }

    public static int delete(MapHandler handler) throws SQLRuntimeException {
        Database dbh = DatabaseManager.getDatabase();
        return dbh.deleteBy(Book.class, handler);
    }

    //---------------------------------------------------------------

    public static JoinedActiveRecord join(Class othertype) throws SQLRuntimeException {
        return new JoinedActiveRecord(Book.class, othertype, true);
    }

    public static JoinedActiveRecord join(Class othertype, boolean autoJoin) throws SQLRuntimeException {
        return new JoinedActiveRecord(Book.class, othertype, autoJoin);
    }

    public static JoinedActiveRecordM join(String selfname, Class othertype, String othername) throws SQLRuntimeException {
        return new JoinedActiveRecordM(Book.class, selfname, othertype, othername);
    }

    /////////////////////////////////////////////////////////////////

    public Book() {
    }

    public Book(String publisher, String id, String title, String author, Date issue_date, Date update_date, Date create_date) {
        this.publisher = publisher;
        put("publisher", publisher);
        this.id = id;
        put("id", id);
        this.title = title;
        put("title", title);
        this.author = author;
        put("author", author);
        this.issue_date = issue_date;
        put("issue_date", issue_date);
        this.update_date = update_date;
        put("update_date", update_date);
        this.create_date = create_date;
        put("create_date", create_date);
    }

    /////////////////////////////////////////////////////////////////

    public static final Column PUBLISHER = new Column(Book.class, "PUBLISHER", String.class, new Integer(2), false);

    private String publisher = null;

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
        put("publisher", publisher);
    }

    public void putPublisher(Map __row__) {
        __row__.put("publisher", publisher);
        __row__.put("PUBLISHER", publisher);
        __row__.put("Book.publisher", publisher);
        __row__.put("BOOK.PUBLISHER", publisher);
        __row__.put("book.publisher", publisher);
        __row__.put(PUBLISHER, publisher);
    }

    /////////////////////////////////////////////////////////////////

    public static final Column ID = new Column(Book.class, "ID", String.class, new Integer(3), false);

    private String id = null;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
        put("id", id);
    }

    public void putId(Map __row__) {
        __row__.put("id", id);
        __row__.put("ID", id);
        __row__.put("Book.id", id);
        __row__.put("BOOK.ID", id);
        __row__.put("book.id", id);
        __row__.put(ID, id);
    }

    /////////////////////////////////////////////////////////////////

    public static final Column TITLE = new Column(Book.class, "TITLE", String.class, new Integer(256), false);

    private String title = null;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
        put("title", title);
    }

    public void putTitle(Map __row__) {
        __row__.put("title", title);
        __row__.put("TITLE", title);
        __row__.put("Book.title", title);
        __row__.put("BOOK.TITLE", title);
        __row__.put("book.title", title);
        __row__.put(TITLE, title);
    }

    /////////////////////////////////////////////////////////////////

    public static final Column AUTHOR = new Column(Book.class, "AUTHOR", String.class, new Integer(256), true);

    private String author = null;

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
        put("author", author);
    }

    public void putAuthor(Map __row__) {
        __row__.put("author", author);
        __row__.put("AUTHOR", author);
        __row__.put("Book.author", author);
        __row__.put("BOOK.AUTHOR", author);
        __row__.put("book.author", author);
        __row__.put(AUTHOR, author);
    }

    /////////////////////////////////////////////////////////////////

    public static final Column ISSUE_DATE = new Column(Book.class, "ISSUE_DATE", Date.class, null, true);

    private Date issue_date = null;

    public Date getIssue_date() {
        return issue_date;
    }

    public void setIssue_date(Date issue_date) {
        this.issue_date = issue_date;
        put("issue_date", issue_date);
    }

    public void putIssue_date(Map __row__) {
        __row__.put("issue_date", issue_date);
        __row__.put("ISSUE_DATE", issue_date);
        __row__.put("Book.issue_date", issue_date);
        __row__.put("BOOK.ISSUE_DATE", issue_date);
        __row__.put("book.issue_date", issue_date);
        __row__.put(ISSUE_DATE, issue_date);
    }

    /////////////////////////////////////////////////////////////////

    public static final Column UPDATE_DATE = new Column(Book.class, "UPDATE_DATE", Date.class, new Integer(6), false);

    private Date update_date = null;

    public Date getUpdate_date() {
        return update_date;
    }

    public void setUpdate_date(Date update_date) {
        this.update_date = update_date;
        put("update_date", update_date);
    }

    public void putUpdate_date(Map __row__) {
        __row__.put("update_date", update_date);
        __row__.put("UPDATE_DATE", update_date);
        __row__.put("Book.update_date", update_date);
        __row__.put("BOOK.UPDATE_DATE", update_date);
        __row__.put("book.update_date", update_date);
        __row__.put(UPDATE_DATE, update_date);
    }

    /////////////////////////////////////////////////////////////////

    public static final Column CREATE_DATE = new Column(Book.class, "CREATE_DATE", Date.class, new Integer(6), false);

    private Date create_date = null;

    public Date getCreate_date() {
        return create_date;
    }

    public void setCreate_date(Date create_date) {
        this.create_date = create_date;
        put("create_date", create_date);
    }

    public void putCreate_date(Map __row__) {
        __row__.put("create_date", create_date);
        __row__.put("CREATE_DATE", create_date);
        __row__.put("Book.create_date", create_date);
        __row__.put("BOOK.CREATE_DATE", create_date);
        __row__.put("book.create_date", create_date);
        __row__.put(CREATE_DATE, create_date);
    }

    /////////////////////////////////////////////////////////////////

    public Publisher toPublisher() {
        return (Publisher) to(Publisher.class);
    }

    /////////////////////////////////////////////////////////////////


                                
                                public void additionFunc() {
                                        /* class name */
                                        // Book
                                        // book
                                        // BOOK
                                        // Book

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        Database dbh = DatabaseManager.getDatabase();
                                        // processing...
                                }
                        
                        

                                
                                public void additionFuncPublisher() {
                                        /* class name */
                                        // classname: Book
                                        // classname.lowercase: book
                                        // classname.upsercase: BOOK
                                        // classname.capitalize: Book

                                        /* property name */
                                        // propname: publisher
                                        // propname.lowercase: publisher
                                        // propname.uppercase: PUBLISHER
                                        // propname.capitalize: Publisher

                                        /* property type */
                                        // proptype: String

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        // processing...
                                }
                                
                        

                                
                                public void additionFuncId() {
                                        /* class name */
                                        // classname: Book
                                        // classname.lowercase: book
                                        // classname.upsercase: BOOK
                                        // classname.capitalize: Book

                                        /* property name */
                                        // propname: id
                                        // propname.lowercase: id
                                        // propname.uppercase: ID
                                        // propname.capitalize: Id

                                        /* property type */
                                        // proptype: String

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        // processing...
                                }
                                
                        

                                
                                public void additionFuncTitle() {
                                        /* class name */
                                        // classname: Book
                                        // classname.lowercase: book
                                        // classname.upsercase: BOOK
                                        // classname.capitalize: Book

                                        /* property name */
                                        // propname: title
                                        // propname.lowercase: title
                                        // propname.uppercase: TITLE
                                        // propname.capitalize: Title

                                        /* property type */
                                        // proptype: String

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        // processing...
                                }
                                
                        

                                
                                public void additionFuncAuthor() {
                                        /* class name */
                                        // classname: Book
                                        // classname.lowercase: book
                                        // classname.upsercase: BOOK
                                        // classname.capitalize: Book

                                        /* property name */
                                        // propname: author
                                        // propname.lowercase: author
                                        // propname.uppercase: AUTHOR
                                        // propname.capitalize: Author

                                        /* property type */
                                        // proptype: String

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        // processing...
                                }
                                
                        

                                
                                public void additionFuncIssue_date() {
                                        /* class name */
                                        // classname: Book
                                        // classname.lowercase: book
                                        // classname.upsercase: BOOK
                                        // classname.capitalize: Book

                                        /* property name */
                                        // propname: issue_date
                                        // propname.lowercase: issue_date
                                        // propname.uppercase: ISSUE_DATE
                                        // propname.capitalize: Issue_date

                                        /* property type */
                                        // proptype: Date

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        // processing...
                                }
                                
                        

                                
                                public void additionFuncUpdate_date() {
                                        /* class name */
                                        // classname: Book
                                        // classname.lowercase: book
                                        // classname.upsercase: BOOK
                                        // classname.capitalize: Book

                                        /* property name */
                                        // propname: update_date
                                        // propname.lowercase: update_date
                                        // propname.uppercase: UPDATE_DATE
                                        // propname.capitalize: Update_date

                                        /* property type */
                                        // proptype: Date

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        // processing...
                                }
                                
                        

                                
                                public void additionFuncCreate_date() {
                                        /* class name */
                                        // classname: Book
                                        // classname.lowercase: book
                                        // classname.upsercase: BOOK
                                        // classname.capitalize: Book

                                        /* property name */
                                        // propname: create_date
                                        // propname.lowercase: create_date
                                        // propname.uppercase: CREATE_DATE
                                        // propname.capitalize: Create_date

                                        /* property type */
                                        // proptype: Date

                                        /* ant property */
                                        // basedir: C:\eclipse\workspace\rubbish-db\sample\hsqldb
                                        // sample.src: C:\eclipse\workspace\rubbish-db\sample\hsqldb/../src

                                        // processing...
                                }
                                
                        
    public String toString() {
        return (new BeanWrapper(this)).toString();
    }

    public Map toMap() {
        Map map = new HashMap();
        putPublisher(map);
        putId(map);
        putTitle(map);
        putAuthor(map);
        putIssue_date(map);
        putUpdate_date(map);
        putCreate_date(map);
        return map;
    }

    public static Set columns = new HashSet();

    static {
        columns.add(PUBLISHER);
        columns.add(ID);
        columns.add(TITLE);
        columns.add(AUTHOR);
        columns.add(ISSUE_DATE);
        columns.add(UPDATE_DATE);
        columns.add(CREATE_DATE);
    }

}