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: Can we persist into SQL3 ARRAY type?
PostPosted: Thu Jul 01, 2004 1:47 pm 
Beginner
Beginner

Joined: Thu Jul 01, 2004 1:30 pm
Posts: 20
Location: Tucson, AZ
For example, in Postgresql, we can create table like this (notice the ARRAY type of column "a"):
CREATE TABLE tt (a int[ ], b int);

Then we can insert data (including an int array) like this:
INSERT INTO tt (a, b) VALUES ('{1, 2, 3}', 50);

When selecting data, we can see:
test=# SELECT * from tt;
{1,2,3} | 50

Now the question is that can we map Java arrays, lists, etc. into a SINGLE database column of SQL type ARRAY? I did not find the information about this in the hibernate.org document.

The reason I want to do this is I have some fixed size arrays (e.g., a 4-element coordination vector), but I don't want to separate them into 4 columns, if possible.

Any help is greatly appreciated!

Thanks,
Stanley


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 01, 2004 1:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
If you know how to do it using JDBC, writing a custom UserType for the Property should be trivial.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 01, 2004 2:33 pm 
Beginner
Beginner

Joined: Thu Jul 01, 2004 1:30 pm
Posts: 20
Location: Tucson, AZ
michael wrote:
If you know how to do it using JDBC, writing a custom UserType for the Property should be trivial.


Thank you very much for your help! This really provides much flexibility!


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.