MSrobots;4427 wrote:Hi Ivar,
In the forum here I stumbled over some post a year old claiming nhibernate would deliver different DB under one API. Did that ever worked out ?
I didn't fully finish it.
It worked perfectly in a Winforms app. Well, I might have introduced some bugs converting SQL code to nHibernate (more than 95 stored procedures), and I cannot say anything about performance, but overall, it seemed to work.
When I put it from the WinForms into the API, then it lost the initial config after loading the initial configuration for unknown reason.
It might have been related to nHibernate 3 being an alpha-release back then, or an issue with a static variable.
(
nHibernate loads information on the entire schema from XML files into it's configuration.
I put the object holding the configuration into a static variable, because I wanted to create static classes and methods for that I don't have to create an instance of a class always, because when nHibernate creates the factory (which it would have to do for each instance), it loads and reads many XML config files, which takes almost 10 to 15 seconds, so it should only be done once at startup. For unknown reason that static object - or an object withing the object - becomes somehow NULL, while == NULL is false...
The other possibility is that the API calls init, then somehow disposes, and for further calls passes connection string + query to a new instance each, which would explain why my config-object is/was always NULL. Anyway, I need to somehow eliminate that static variable, because it probably isn't thread-safe.
)
I filed a bug report for nHibernate, which was ignored, claiming that there probably was something wrong with my XML files.
It got on my nerveres, I did some other things in-between, waiting for nHibernate to get out of Alpha.
Then, my laptop's hard-disk crashed. I had (and still have) a backup somewhere, just de-dusted it recently, to get the old version of the server that worked. Maybe I'll make a fresh attempt to finish this soon.
I also used nHibernate to create the database schema for MS-SQL, MySQL, PostGre, Oracle and Firebird - which worked like a charm.
The main problem there was getting Oracle to run on Ubuntu. The makefiles Oracle supplies with the installer were riddled with bugs, but RedHat/Oracle uses an older gcc version, which doesn't detect that...
I recently managed to get Sybase and MS-Access (v2003) to work on Linux, but there seems to be a few little bugs in the mono ODBC pinvoke calls (int32 used instead of int64 for 64-bit Linux systems), so these are next.