r/java • • Jul 10 '15

Our exception handling at work

http://imgur.com/4wgxCvv
259 Upvotes

135 comments sorted by

View all comments

Show parent comments

12

u/dardotardo Jul 10 '15

I'd actually disagree on the persistence part. Larger projects tend to require more manual SQL which needs to be able to be tuned easily. That said, SQL should be maintained within a separate file and definitely not built dynamically.

11

u/vitingo Jul 10 '15

SQL should be maintained within a separate file

Meh. If you put SQL in a separate file, you have to configure a reloadable property file reader or else you miss out on VM hotswap. Also, dynamic SQL is useful in many cases, like criteria queries. Sometimes, though, SQL gets too hairy to inline in your DAO method.

5

u/After_Dark Jul 10 '15

I'm pretty sure there is no proper/good way to do SQL in Java, just less bad ways.

1

u/segv Jul 11 '15

I've found that Guice + MyBatis (3.x line, not the 2.x line) is pretty nice in this regard.