22.11.11

Development schema, production schema | Javalobby

Development schema, production schema | Javalobby


There are some interesting information in this post. First of all, I need some information about jOOQ.

http://www.jooq.org/

What is jOOQ?

jOOQ stands for Java Object Oriented Querying. It combines these essential features:

  • Code Generation: jOOQ generates a simple Java representation of your database schema. Every table, view, stored procedure, enum, UDT is a class.
  • Active records: jOOQ implements an easy-to-use active record pattern. It is NOT an OR-mapper, but provides a 1:1 mapping between tables/views and classes. Between columns and members.
  • Typesafe SQL: jOOQ allows for writing compile-time typesafe querying using its built-in fluent API.
  • SQL standard: jOOQ supports all standard SQL language features including the more complex UNION's, nested SELECTs, joins, aliasing
  • Vendor-specific feature support: jOOQ encourages the use of vendor-specific extensions such as stored procedures, UDT's and ARRAY's, recursive queries, and many more.

How does jOOQ help you?


  • Your database always comes FIRST! That's where the schema is, not in your Java code or some XML mapping file.
  • Your schema is generated in Java. You can use auto-completion in your IDE!
  • Your "value objects" or "data transfer objects" are generated too. This keeps things DRY
  • Your Java code won't compile anymore when you modify your schema. That means less runtime errors.
  • You and your DBA can be friends again because you have full control over your SQL.
  • You can port your SQL to a new database. jOOQ will generate SQL that works on any database.
  • You won't have syntax errors in your query.
  • You won't forget to bind variables correctly. No SQL injection, either.
  • You can forget about JDBC's verbosity (especially useful when dealing with UDTs, ARRAYs and stored procedures).
Or in short:

  • You can be productive again!
I am going to love jOOQ, at least this idea.

Then, let's go back to the POST itself.

If you’re lucky and you can afford multiple Oracle / other-expensive-database licenses, you might clone the same schema / owner name for every application instance on different servers. But sometimes, you can’t do that, and you have to put all schemata in the same box and name them:

DB_DEV
DB_TEST
DB_PROD

Or worse… several productive instances in the same box

Then how jOOQ is going to help?

With jOOQ, it’s simple. jOOQ always generates the schema / owner in the generated SQL statements.










No comments: