-->
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.  [ 1 post ] 
Author Message
 Post subject: QuickStart with SQL 2005 Express (true story)
PostPosted: Fri Jul 11, 2008 4:59 am 
Newbie

Joined: Fri Jul 11, 2008 4:45 am
Posts: 1
Going through the QuickStart for nHibernate I ran into the following pecularities. I though I'd share them here, so maybe other people can benefit from it and do not have to spend an hour googling (as I did):

I used Microsoft SQL Server Express 2005 as database; Visual Studio 2008 as IDE (but this should probably work for all version of VS) created the Cat table and its coloms. I also started a new Web Application and changed the web-config.

1) First problem: I can’t connect to the server and keep getting the ‘Server is not configured for external connections’-message.
Fix:What caused it with me is the fact that SQL Express by default installes itself as a names server. So, in the connectionstring for the nHibernate connection you should put:

Code:
<property name="connection.connection_string">Server=(local)\sqlexpress;Initial Catalog=QuickStart;Integrated Security=true</property>

Instead of just ‘Server=(Local)’.

2) After this, I got a that the entity QuickStart.Cat could not be found.
Fix:Turns out the cat.hbm.xml-file couldn’t be found by nHibernate. Setting the Build Action to ‘Embedded Resource’ fixed this for me.

3) NHibernate started complaining (through a InvalidProxyTypeException) that the Cat class couldn’t be used as Proxy since it didn’t support lazy-loading.
Fix: There were a couple of options to fix this; I chose the simplest of the three: adding the lazy="false" attribute to the <class>-tag in cat.hbm.xml.

4) After this, my Cat was finally saved.


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

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:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.