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.  [ 3 posts ] 
Author Message
 Post subject: Map an array of values to a single column?
PostPosted: Sun Oct 15, 2006 1:11 pm 
Beginner
Beginner

Joined: Mon Nov 07, 2005 11:06 pm
Posts: 28
How would I map an array or list of value types to a single column in my table? The example is this...

The customer class has a property "CustomerTypes" and is a simple string array or a generic string list. My database has a table "Customers" with a nvarchar field "CustomerTypes".

I want to be able to store the types as a simple nvarchar value in the customers table, but work with them as an array or IList<string>.

I cannot figure this out. I am sure it is simple to do.

Any help greatly appreciated!

Kevin


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 15, 2006 5:46 pm 
Contributor
Contributor

Joined: Sat Sep 24, 2005 11:25 am
Posts: 198
You can write a user type to do this for you.
A word of caution first, there is a reason why databases doesn't support this natively, it goes against the way they operate, and likely to land you into trouble further down the road.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 15, 2006 7:32 pm 
Beginner
Beginner

Joined: Mon Nov 07, 2005 11:06 pm
Posts: 28
Yes, I think I am going to go ahead and create a separate table to support this. Thanks.

Kevin


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