-->
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.  [ 2 posts ] 
Author Message
 Post subject: SQL Server UDT
PostPosted: Mon Aug 22, 2005 12:17 pm 
Newbie

Joined: Sat Jul 09, 2005 1:17 pm
Posts: 17
I have a UDT in my SQL Server table column which only allows the characters 'W', 'M' and 'T'. I am mapping this to a char property in my NHibernate class. When I retrieve the value of this column I get garbage back.

How do I map UDTs to an NHibernate class property?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 25, 2005 3:39 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 11:38 am
Posts: 28
I tested it and it worked beautifully. So unless you post some code probably nobody will be able to help you.

First I defined a rule "OnlyTM":
Code:
@value IN ('T', 'M')


The I defined a type TestType: Data Type "char", Length "1", Rule "dbo.OnlyTM"

Finally I defined a column "Test" with type "TestType"

Here is the mapping property:
Code:
<property name="Test" column="Test" type="System.Char"/>


And here is the C# code
Code:
char m_Test = ' ';
public char Test
{
   get { return m_Test; }
   set { m_Test = value; }
}


Take care, Christoph


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.