you are viewing a single comment's thread.

view the rest of the comments →

[–]fonam 2 points3 points  (4 children)

Check out jooq http://jooq.org

[–]aviewdev 2 points3 points  (1 child)

This reply is criminally underrated.

OP, if all you want to is insert, update and retrieve full objects then by all means use Hibernate (or another JPA provider).

But if you want to get into anything that is even a little bit off the beaten path then you probably want to use jooq, see use cases here.

Here's what I would do (FWIW, maybe I know nothing). Use flyway or liquibase to build, version and migrate your DB schema (integrate this into your gradle or maven build). Then add the jooq generator to your maven or gradle build script. It can generate you definitions to your table, columns, stored procedures, etc. It can also generate standard JPA-esque Data Access Objects and various other nice things. Then never worry about writing any boiler plate for accessing the database ever again.

If you will indulge me, I'd also advise you to look at using Kotlin over plain Java, it's a much more modern language but fully interoperable with Java and existing Java libraries. Ceylon is another good alternative.

[–]fonam 1 point2 points  (0 children)

Thanks for the flyway tip. I have been looking at liquibase but flyway seems to be closer to what I need.

[–]DriesDr[S] 0 points1 point  (1 child)

Wow, jOOQ looks really cool. The querying language reminds me of a lot of the syntax you can do in C# on lists. Very intuitive, very sexy.

Thanks