-->
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: Column Based Array
PostPosted: Thu Aug 14, 2008 7:12 pm 
Newbie

Joined: Thu Aug 14, 2008 7:03 pm
Posts: 2
Hi all,

I am new to hibernate and already love it! Thanks to all the great work put into it. There's one thing I'd like to do that I cannot figure out the elegant way to do (and thus I think I haven't figure out the right way to do): I have a DB representing vectors (double[] in Java) for math research. I can use a <primitive-array> tag and map correctly (see below), but that wastes tremendous amount of space (key and index...). The solution I imagine to store only the value in a column-based model for my vector: each row is a vector and columns are its values.

Ultimately I'd like to have a table with n (from 100 to 1500) columns. How would I go on to specify such a table in hbm?

Thank you very much for your help,

_Stephane

Hibernate version: 3.2

Mapping documents:
Code:
<primitive-array name="vector" table="normalized_vector">
     <key column="vector_id" />
     <index column="elem_index" type="int" />
     <element column="elem_value" type="double" />
</primitive-array>



Name and version of the database you are using: MySQL


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 14, 2008 8:46 pm 
Newbie

Joined: Thu Aug 14, 2008 7:03 pm
Posts: 2
I have found a non-elegant solution again (but I am afraid this is the only one)...

Basically I created a CustomType (Vector) based on the "DoubleStringType" file. The associated hbn file is awefull:

Code:
<hibernate-mapping>
   <class name="org.salsadev.index.data.Vector" table="vector"
      catalog="SALSA_INDEX">
      <id name="id" type="java.lang.Long">
         <column name="id" />
         <generator class="identity" />
      </id>
      <property name="values" type="xxx.data.hbn.VectorType">
         <column name="dim_0"/>
         <column name="dim_1" />
         <column name="dim_2" />
         <column name="dim_3" />
         <column name="dim_4" />
         <column name="dim_5" />
         <column name="dim_6" />
....
         <column name="dim_99" />
      </property>
   </class>
</hibernate-mapping>


If anyone has a better idea :D


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.