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.  [ 1 post ] 
Author Message
 Post subject: parameterized custom mapping
PostPosted: Sat Aug 23, 2008 9:39 am 
Newbie

Joined: Tue Dec 16, 2003 8:34 am
Posts: 15
Using Hibernate 3.2.x.

I would like to map a range of coumns from a single table into a single primitive array value in a persistent class.

Table

time_series

id bigint,
value1 bigint,
value2 bigint,
value3 bigint,
...
value50 bigint

Persistent Class

Code:
public class TimeSeries {
   print long id;
   private long[] values;
...
}


I would like to devise a custom mapping that does not require me to enumerate all 50 column names in the mapping file. Instead, I would like to specify a column name pattern, and a length; e.g.

Code:
<hibernate-mapping>

        <class name="TimeSeries"
            table="time_series">
               
                <id name="id">
                        <generator class="native"/>
                </id>
                <property name="values">
                    <type name="MyCustomType">
                        <param name="columnNameBase"> value</param>
                        <param name="columnCount"> 50</param>
                    </type>
                </property>
...


But the UserType /CompositeUserType interfaces seem to assume that the column names are hardwired in the mapping document.

What interfaces/mechanisms are available to me to control the generation of mapped column names at runtime?

thanks for any pointers.

Joe


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.