Skip to content

Add a constuctor with table name parameter #1000

@gonwan

Description

@gonwan

The generated meta class has only one constructor with default table name. It would be better to add the possibility to use a customized table name, which helps sql rewriting. See comments inline.

    @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: t_user")
    public static final class TUser extends AliasableSqlTable<TUser> {
        public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);

        public final SqlColumn<String> username = column("username", JDBCType.VARCHAR);

        public final SqlColumn<String> password = column("password", JDBCType.VARCHAR);

        public TUser() {
            super("t_user", TUser::new);
        }

        /* !!! add this one !!! */
        public TUser(String tableName) {
            super(tableName, TUser::new);
        }

    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions