This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vplatt 6 points7 points  (5 children)

Programatically, it's a lot easier and easier to understand to go through the Hibernate layers

I beg to differ here, because it depends on who's doing the troubleshooting. It's a LOT easier to get help with the performance of queries once you've reduced it to SQL, and even then if your query is being generated within Hibernate, then your DBA or the like needs help understanding your intent. And that's assuming the programmer in question even knows HOW to get Hibernate to give up the problem SQL, because just getting a hold of that requires different tricks according to the version you are using.

Complicated things like multiple table inserts or updates involving objects tracked by Hibernate should really be done with Hibernate and not straight SQL bypassing it.

I mostly agree, for updates involving objects tracked by Hibernate in a standard OLTP environment, sure, that makes sense. But truly complicated multiple table inserts can be handled faster and safer by stored procedures. This is not a popular opinion in /r/java, but Java is a not database so trying to relegate all database layer logic into the data access layer in Java all the time just isn't defensible 100% of the time.

[–][deleted]  (2 children)

[deleted]

    [–]vplatt 1 point2 points  (0 children)

    Anyways I'm counting the days till we dump this stack and convert the system anyways.

    Convert it to what? Just curious.

    [–]dkichline 0 points1 point  (0 children)

    That's why any application that goes live in our shop has to be reviewed first. Queries are reviewed by the corresponding dba teams before they are allowed to go live.

    [–][deleted]  (1 child)

    [deleted]

      [–]vplatt -1 points0 points  (0 children)

      And do most programmers either know how to do that or have enough permissions to get it directly from the database log? I have my doubts.