I usually refrain from making posts that just end up referencing the work of others, but while looking for something else I just came across two blog posts from late-November of 2008 where Davy Brion goes into some detail about how to use stored procedures with NHibernate to both retrieve and instantiate a mostly-flat object (one without a terribly-deep object graph) and also more complex objects that hold collections of other objects.
In the time both during and since my Summer of NHibernate screencast series where I touched briefly on how to use SPROCS with NHibernate, I’ve fielded questions from several viewers and readers about getting further references about techniques for how to do this. While I tried my best to point people in the right direction, I’m sure I wasn’t really able to be as helpful as I’d liked since I have little experience (thankfully!) working in an all-sproc, DBA-Nazi-controlled data environment.
But for those that are both interested in using NHibernate and constrained in a SPROC-only world, here are two posts that pretty succinctly demonstrate some of the techniques that you will need to consider mastering to make this work…
http://davybrion.com/blog/2008/11/populating-entities-from-stored-procedures-with-nhibernate/
I still hate SPROCs by Default
For the record, I’m still philosophically predisposed against mandating the use of sprocs for all database interaction because I pretty strongly believe that its a false ROI in all but some of the more complex server-side manipulation cases, but in case you find yourself trapped in such a scenario and still want to use NHibernate, these posts will certainly give you some idea of how to approach getting your work done.
Yeah I also hate stored procedures and trigger but for mammoth enterprise systems like of Ebay, Amazon, Yahoo! and so on, can you work without triggers and SP?
I don’t have experience with such large enterprise so, I certainly can’t say.
For systems I am developing for, certainly does not require them so, I have not used them at all. I also cant get how one can integrate business logic in SP and triggers?
And also I have been quite inspired by this article: http://www.tonymarston.net/php-mysql/stored-procedures-are-evil.html
@Prajwal:
Interesting post you reference there — it mostly sums up in one place all the arguments against sprocs that I have come to believe in myself after many years of hard-learned lessons in complex systems.
But rather than ‘toss the baby out with the bathwater’, I think that sprocs have a place just like many other technologies but just like most other technologies their indiscriminate application regardless of the context is a recipe for disaster.
Sprocs like all technologies are neither good nor evil but their application sure can be 🙂
Steve:
IQueryableI’ve been taking LINQ to NHibernate (Alpha just released, http://groups.google.com/group/nhusers/browse_thread/thread/b7a3f537f4cbf46d
are you planning to have any screen cast on LINQ TO NHIB?
thanks.