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: Problem: Property colum name having spaces...
PostPosted: Thu Feb 07, 2008 6:52 am 
Newbie

Joined: Thu Feb 07, 2008 6:48 am
Posts: 14
Hello,

I have the following xml line in my nhibernate mapping file:

<property name="MaxRowWidth" column="Max Row Width" />

As you can see the database uses column names with spaces BUT nhibernate does not allow having whitespace in the column name.

It's no option to remove the spaces from the databasecolumn.

Any idea how to solve this? (Already tried: [] and ` `)

Thanks in advance!
Marten


Top
 Profile  
 
 Post subject: Problem: Property colum name having spaces...
PostPosted: Thu Feb 07, 2008 9:31 am 
Senior
Senior

Joined: Thu Jun 21, 2007 8:03 am
Posts: 127
Location: UK
Hi Marten,

Using square brackets has worked for me in the past:
Code:
<property name="MaxRowWidth" column="[Max Row Width]" />


I was using SQL Server at the time ... which database are you using?

Perhaps there is another syntax unique to the database vendor you're using?

Regards,
Richard


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 12, 2008 3:14 am 
Newbie

Joined: Thu Feb 07, 2008 6:48 am
Posts: 14
Richard,
Thank you for your input! The [ ] did solve the problem. Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 13, 2008 4:44 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Actually, the square brackets will not work with all databases, so if you want to do this in a database agnostic fashion use backticks (`) instead.

Symon.

_________________
Symon Rottem
http://blog.symbiotic-development.com


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