NHibernate

F

Fabiano

Please,

i would like to know if there's a good idea use NHibernate at my programs
besides native data tier of .NET.

Java mans love it very much, but i don't know if its going to be a nice way
in .NET

You guys, what think about?

Tks in adv
Fabiano
 
A

Aquila Deus

Fabiano said:
Please,

i would like to know if there's a good idea use NHibernate at my programs
besides native data tier of .NET.

I tried to use Hibernate for a web menu/permission management system a
month ago. It's very convenient but not suitable for any complex
things. In my case I was trying to create a table of menus and items
which have foreign key references (parent menus) to the same table, and
it simply crashes.

Even if it doesn't crash, I wouldn't know how to optimize the db query
performance. It brings another SQL-like query language, but only works
within your Java code, thus you can't isolate the db part and test it
alone.
Java mans love it very much, but i don't know if its going to be a nice way
in .NET

You guys, what think about?

Unless your db stuff could be done in toy RDBMS like MySQL, it really
sux. The more you use it, the more troubles you will find.

After wasting three days on Hibernate I switched back to use stored
procedures. I wrote down the API docs and implementation for SQL Server
within a few days, no hassle at all, you get what you expect.
 
J

Jon Skeet [C# MVP]

Aquila Deus said:
I tried to use Hibernate for a web menu/permission management system a
month ago. It's very convenient but not suitable for any complex
things. In my case I was trying to create a table of menus and items
which have foreign key references (parent menus) to the same table, and
it simply crashes.

Were you using a release build, or the most current development one?
I've seen examples doing the same thing with no problems. Maybe there
was a fault and it's been fixed.
Even if it doesn't crash, I wouldn't know how to optimize the db query
performance.

That just means you need to learn to use Hibernate effectively. That's
going to take time, but most effective technologies take a bit of
learning to use effectively.
It brings another SQL-like query language, but only works
within your Java code, thus you can't isolate the db part and test it
alone.

You can easily see the SQL which is generated, and look at that
closely. If you can't get the best SQL from Hibernate, you can specify
the SQL itself these days, but still get Hibernate to do the mapping.

(Personally I avoid the HQL syntax for the most part and use criteria
queries, so I'm even bothering to learn HQL.)

Also note that if you keep your DB access separate from other business
logic, you can still effectively isolate the DB part and test it on its
own. The difference is that you're testing it in the same way that the
rest of your code is going to use it.
Unless your db stuff could be done in toy RDBMS like MySQL, it really
sux. The more you use it, the more troubles you will find.

Whereas I'm finding it to be *incredibly* helpful.
After wasting three days on Hibernate I switched back to use stored
procedures. I wrote down the API docs and implementation for SQL Server
within a few days, no hassle at all, you get what you expect.

Well, there are certainly different needs and Hibernate won't be useful
for all projects, but it's fantastic for the stuff we're doing - and
will be especially so when we have to support Oracle as well.

Note that my experience has only been with Hibernate though - I haven't
tried NHibernate yet.
 
P

Peter Kirk

Aquila Deus said:
Unless your db stuff could be done in toy RDBMS like MySQL, it really
sux. The more you use it, the more troubles you will find.

After wasting three days on Hibernate I switched back to use stored
procedures. I wrote down the API docs and implementation for SQL Server
within a few days, no hassle at all, you get what you expect.

I used Hibernate in a reasonlably complex project written in Java. There was
a learning curve associated with Hibernate (certainly more than 3 days), but
once you get past a certain point it is incredibly powerful and relieves you
of a lot of database stuff (I hate writing all that SQL). Sure there is XML
configuration etc, but I just loved being able to concentrate more on my
Java objects than on the database side of things.

I have never used (or heard of) Nhibernate before.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top