1. Study materials

2. Study materials

3. Exercises Week 11

3.1. Play

Play with the exercises and examples in the oracle tutorial.

3.2. Spice up a Student

In the project reflection in this week’s repository directory you find a Student class declared and spiced up with lombok. Get yourselves a taste of it and have fun.

If you are curious: Use reflection in your test classes to find out what work lombok take off of your hands. (Read as: this is the exercise).

Welcome in 'Schlaraffenland', 'Luilekkerland', or Cockaigne, the land of milk and honey

3.3. Generate a table definition for ae entity

Use the previous project.
Take the lombokked Student class definition as your entity and reflectively create a (postgreSQL) table definition from it, including definition of types and (primary key) constraint.

Try to make your TableCreatorImpl as generic as possible, that is, have the caller specify the entity type, e.g. Student.class and make you TableCreator generator the table.

The interface definition of the TableCreator is

interface TableCreator {

   * Write the sql definition of a table for an entity type.
   * The table should be named using simple plural, like
   * {@code entityType.getSimpleName().toLowerCase() + 's'}.
   * The column names should be dutch casing (bicyclePump -> bicyclepump).
   * If a field is Annotated with {@code @literal{@}ID}, the first field with
   * that annotation is tagged primary key.
   * @param out stream to print to
   * @param entityType class of the type of the records in the table.
  <E> void createTable( PrintStream out, Class<E> entityType );