-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Migrate from Firebird to SqlServer2005 Express
PostPosted: Thu Mar 02, 2006 11:36 am 
Newbie

Joined: Mon Feb 20, 2006 6:31 am
Posts: 17
I noticed strange behaviour when migrating an application from FireBird to MS SqlServer2005 Express. Normally all I have to do is change the settings in the web.config file (connection string, dialect and driver_class) I am however getting an NHibernate.HibernateException whenever I try to save a new object:
Illegal attempt to associate a collection with two open sessions. I don't know why it's only thrown when I work with SQL Server and not with Firebird. Does anyone have experience with these databases?

I assumed the migration would be as easy as changing the settings in the config file. I presented this to my IT manager as a major advantage for NHibernate over stored procedure. I even tested it with a small application that I first started on SQL server and moved to Oracle in less than 30 minutes... Now they asked me to migrate a real app from Firebird to MS SqlServer, so I hope I won't have to disappoint them because of strange behaviour like this!

Thanks in advance for any help!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 02, 2006 4:32 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Looks very strange to me too. I think you must have changed something else besides the settings.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 03, 2006 3:49 am 
Newbie

Joined: Mon Feb 20, 2006 6:31 am
Posts: 17
I wish it was so, but I just swapped the config files, back for Firebird and it works perfect again! Is there any difference in the way Firebird and SQL Server handle sessions (or the API's used for database acces)?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 06, 2006 6:27 am 
Newbie

Joined: Mon Feb 20, 2006 6:31 am
Posts: 17
So I found the problem. It was a caused by an empty DateTime field that was accepted by Firebird (it allows dates to be 1/1/1), but rejected by SqlServer (1/1/1 < 1/1/1753 which is minValue of SqlDateTime). Since the original author of the code did not catch his exceptions in his DAO object, but only in his presentation layer, he missed the session.Close() statement. Hence on the second attempt, the exception "Illegal attempt to associate with 2 sessions" was correctly thrown by NHibernate... (found clue to the solution for this on another thread in this forum...)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.