With increasing feedback and a slowly growing community, jOOQ should
think about some major redesign questions. These are mostly
incompatible redesigns, which means that jOOQ will need to be
branched. Feel free to provide more feedback, and other suggestions
for new features that should be put in a major release!

Aliasing verbosity
------------------------

As discussed very early with Timo Westkämper from QueryDSL, an
important drawback of jOOQ compared to QueryDSL is the choice of using
static members for fields in tables. The biggest impact of this is the
verbose aliasing as can be seen in this discussion thread:
http://groups.google.com/group/jooq-user/browse_thread/thread/54dc9ebefaba3266

An example of such verbosity:

   // Create table aliases
   Table<TTreeRecord>  parent=  TTree.T_TREE.as("parent");
   Table<TTreeRecord>  child=  TTree.T_TREE.as("child");

   // Create field aliases from aliased table
   Field<String>  parentName=  parent.getField(TTree.NAME).as("parent_name");
   Field<String>  childName=  child.getField(TTree.NAME).as("child_name");

RDBMS inheritance
---------------------------

In a recent discussion with Sander Plas, an enthusiast user of jOOQ,
the idea of replacing (almost) all generated types by interfaces came
up. See the discussion thread here:
http://groups.google.com/group/jooq-user/browse_thread/thread/62e4e9f7ee4af5fb

Aliasing could be done like this (just an example):

    // TTree is now an interface
    TTree parent =

    // which can be accessed statically
    MySchema.tTree().as("parent");

    // Or with import static MySchema.*;
    TTree child = tTree().as("child");

    // Fields are accessed through interface methods
    Field<String> parentName = parent.name().as("parent_name");
    Field<String> childName = child.name().as("child_name");

Also, with interfaces, it will be possible to "inject"
mixin-extensions, such that TTree may be generated like this:

    public interface TTree extends UpdatableTable<TTreeRecord>,
        InheritedType1, InheritedType2, ... InheritedTypeN
        UserType1, UserType2, ... UserTypeN { ... }

    public interface TTreeRecord extends UpdatableRecord<TTreeRecord>,
        InheritedType1Record, ... InheritedTypeNRecord
        UserType1Record, ... UserTypeNRecord { ... }

Where UserTypeN may be defined by users like this:

    public interface UserTypeN {
        Field<Integer> id();
        Field<Timestamp> createdAt();
        Field<Timestamp> modifiedAt();
    }

Similar case: UserTypeNRecord:

    public interface UserTypeNRecord {
        Integer getId();
        void setId(Integer id);

        Timestamp getCreatedAt();
        void setCreatedAt(Timestamp createdAt);

        Timestamp getModifiedAt();
        void setModifiedAt(Timestamp modifiedAt);
    }

Reply via email to