Change the db schema for state

- Name the foreign key state_id instead of state, so we can fetch the
  name of the state as `state` with an left join later
- Add a sort order to state so we know which one is the initial state
- Change the db access layer accordingly
Add support for returning the new id on insert

add an update function and simplify the insert-or-update function
state is now state_id
Simplify state handling

basically just hard code the possible states. No more state table, no
more joins to get the state name. States are just keywords which are
mapped to ints when serialized.
Adapt to the api change in db
All the column names returned by jdbc are lower case
Generate a different dtbook template for commercial audio books