Search Results for: nhibernate

nHibernate, First Look at TSQL

I've blogged in the past about the nHibernate project that has been going on at my company for the last eighteen months. Prior to today, I have only seen the database generated by nHibernate. But today I finally started seeing some TSQL code. My first impressions... oy! There are two levels of concern coming out of the gate. First, it appears that some of the programming decisions, completely independent of nHibernate, are going to cause problems. Second, it appears we're going to be hitting issues with nHibernate. First, the programming decision. I've been using Confio to monitor this server for a few days now (look for upcoming posts on my eval of Confio). Only one day has captured any real activity from the nHibernate team (and yes, I'm basically spying on…
Read More

nHibernate Database, First Look

I'm getting my first look at a full-fledged nHibernate database developed by consultants for our company. I thought I'd share my initial impressions. I'll be capturing trace events from the database over the next couple of weeks, so I'll be following up on the behavior of nHibernate within this database as well. The first thing I saw & thought was, "Foreign key constraints. Thank the gods." That really is good news. I was frankly concerned that they might go with the "let the code handle it" approach. There are quite a few null columns. I'm also seeing tons & tons of nvarchar(255) which must the default string size. Lots of bit fields too. They also used bigint in a lot of places too. None of this is definitively good or bad,…
Read More

A Fix for nHibernate’s Parameter Problem

I had previously outlined a problem with nHibernate code that, in my opinion, was going to cause a lot of problems on production systems especially with memory and the procedure cache. However, it does appear that there is a possible solution. That doesn't eliminate my concerns over nHibernate, but it sure does help.
Read More

nHibernate Recompiles and Execution Plans

One little potential for performance problems that we've seen comes out of how nHibernate generates it's parameratized queries. It limits the length of any parameter to the length of the column, but if the length of that parameter is less than the column, it uses tha smaller length when declaring the variable. This results in a query that looks like this: exec sp_executesql N'INSERT INTO dbo.users (Name, Password, EmailAddress, LastLogon, LogonId) VALUES (@p0, @p1, @p2, @p3, @p4)',N'@p0 nvarchar(8),@p1 nvarchar(6),@p2 nvarchar(12),@p3 datetime,@p4 nvarchar(8)',@p0=N'Ted Cool',@p1=N'abc123',@p2=N'ted@cool.com',@p3='2008-04-29 14:10:44:000',@p4=N'ted_cool' Note the parameter @p4 which is the parameter mapping to the primary key for the little sample table. In this query it's declared as nvarchar( 8 ) because 'ted_cool' is composed of eight characters. But if we changed it to 'ted_coolish': exec sp_executesql N'INSERT INTO dbo.users…
Read More

nHibernate First Impressions

If I'm going to have to support it, I want to understand it. So, I got going yesterday, installing nHibernate 2.0 and walking through the Quick Start Guide. My C# is a bit rusty, to say the least, but I managed to sqeak by. The Guide is meant for an older version of nHibernate and there have been a few changes made that affect the code displayed. What that means is, I had to do more than simply type up what was presented to me. Which, was actually good because it forced me to do a bit more learning in order to get everything to work. What I found was interesting. I can see why developers like this. It really does let you treat the database as just another object…
Read More

nHibernate Database Benefits and Costs?

I posted this question over at SQL Server Central, just like my last post, I'm also posting it here. I need some help. I've been trying to research this and I can't find good, hard facts. Any help would be deeply appreciated. It looks like we might be facing a large project shifting over to using ORM methods through nHibernate. I'm trying to get a read from the database community on what exactly I should expect in terms of issues, challenges and headaches during the development process. I'm also interested in any long term maintenance issues, troubleshooting problems, etc. If your developers implemented ORM all the way down to storing object data on the database in a non-normalized/object oriented fashion, how did that affect you? Did it muck up reporting?…
Read More

Why I Support Code Automation Tools Like ORMs

I know I'm a weirdo. I've always been a weirdo. When I was a DBA (now I only play one on TV), I was a weirdo too. Case in point, ORM tools. Whether we're talking nHibernate, Linq, or Entity Framework, the degree of loathing for these tools by most DBAs is really hard to measure. Yet, after an initial period of difficulty (here are some ancient blog posts documenting that pain), I've come to believe that code generation tools are a very important part of what we do. Further, that they are not evil, or wrong, or bad. Let's talk about this just a little. A Tale of Two Teams At my previous employer there was a degree of friction between the developers and the DBAs (shocking, right). Both sides…
Read More

I Love Entity Framework

I love Entity Framework. I also like (not love) nHibernate. That's right, as a DBA and data professional, I'm telling you I love Object/Relational Mapping tools (ORM). I think this is a technology set that the DBA needs to more tightly embrace. Let me tell you why. Most of the Queries I know that the biggest pushback against Entity Framework (EF) and it's fellow ORM tools is that they generate crap code. I know this to be true. I've seen it. ORM tools can, and do, generate seriously poor T-SQL. That's not to mention the N+1 problem and a few others. However, as you see from the article in that link, these problems and how to avoid them are very well defined. You don't have to suffer from the issues.…
Read More

SQL Azure Cost

We’ve all heard the scary stories. A developer starts testing Azure and then suddenly gets a thousand dollar bill on their credit card. The whole idea behind Azure works of the premise that you are not paying for the infrastructure. Instead of buying servers and disks and racks and switches and routers, you just pay for access and storage. It’s a great model. That model is  especially applicable to small businesses that just can’t  afford the outlay, or to a larger company that wants to perform cheap experiments, or any number of other places where purchasing and maintaining hardware just doesn’t make sense. But what are the costs? That’s a little tricky to answer, truth be told. SQL Azure is charged a monthly fee based on the size and number…
Read More

Thoughts on ORM

I've posted before about issues I'm having either with behaviors of nHibernate, or behaviors of teams using nHibernate, but I don't think I've made my thoughts on ORM too clear. Let me do that now. I think some form of ORM is here to stay. There are lots of different ORM tools out there and acceptance of them is absolutely growing. Further, it should grow. Developing software is hard and if you can write code that reduces the overall amount of code you have to write, I'm in favor of it. I'm not convinced that the current crop of tools are quite as good as they ought to be, but most of them seem very flexible which should mean implementation of them can be, overall, beneficial to your project. That's…
Read More