That is a pretty general question.
I think the fastest (in general) would be the stored procedures and views, then direct JDBC, the NHibernate. Some would argue that since Hibernate has first and second level caches that the performance is close if not better in some situation then executing direct SQL. I see it from more of a maintenance issue. I have executed query strings directly from within code and when table name and/or column names change it is aweful to go back through and do search and replace. Same with storing the SQL in a property file. Hibernate makes this easier with mapping files or annotations. Writing queries in much quicker once you learn HQL which is not hard. For instance I can;t imagine having to do lots of joins any more because Hibernate does it all for me. Building SQL dynamically form user input is a pain, but with Criteria queries it is so simple. I myself have not run into any performance problems wiht Hibernate. The one performance problem I did have and which typically presents itself in every project I have worked is setting the JDBC fetchsize in the Hibernate configuration file. You have to ask yourself this ... if you use store procedures and JDBC direct how will I be using the results? If the answer is converting everyhting in object before you use the result then why not have a ORM tool that doe sit for you and is easy to maintain.
Good luck
|