Aliases are code-generated classes the hold the column meta-data for tables. This meta-data is then used for both building Type-Safe Queries and also the meta-data-driven loading/saving of primitives into ResultSets and PreparedStatements.


This is all generated code, but the basic idea is that it statically defines the table meta-data found at build-time:

    public class ChildAlias extends Alias<Child> {

        // The alias keeps a list, columns, of all of its columns
        private final List<AliasColumn<Child, ?, ?>> columns = new ArrayList<AliasColumn<Child, ?, ?>>();

        // Some basic primitive columns
        public final IdAliasColumn<Child> id = new IdAliasColumn<Child>(this, "id",;
        public final StringAliasColumn<Child> name = new StringAliasColumn<Child>(this, "name",;
        public final IntAliasColumn<Child> version = new IntAliasColumn<Child>(this, "version", ChildCodegen.Shims.version);

        // The parent foreign key has a specific ForeignKeyAliasColumn column with the "on" join method
        public final ForeignKeyAliasColumn<Child, Parent> parent = new ForeignKeyAliasColumn<Child, Parent>(this, "parent_id", ChildCodegen.Shims.parentId);

        public ChildAlias(String alias) {
            super(Child.class, "child", alias);

        // Common Alias columns used by the meta-data mapper
        public List<AliasColumn<Child, ?, ?>> getColumns() {
            return this.columns;

        public IdAliasColumn<Child> getIdColumn() {

        public IntAliasColumn<Child> getVersionColumn() {
            return this.version;

        public IdAliasColumn<Child> getSubClassIdColumn() {
            return null;

        // To avoid foreign key conflicts, entities are topographically sorted at build-time
        // and given a hardcoded insert order to be used during UoW.flush
        public int getOrder() {
            return 21;