-->
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: Making a generator class for a field inside a composite key
PostPosted: Fri Oct 19, 2007 9:02 am 
Newbie

Joined: Fri Oct 19, 2007 8:44 am
Posts: 1
Hi all,
I've a db table with a composite primary key formed by 4 fields: 3 are string and 1 is an integer.
The 3 textual fields are manually inserted by the user, but the integer field is calculated using a complex algorithm (don't ask me why... :-\).

At the moment the composite key is mapped as follows:
Code:
<composite-id name="id" class="MyCompositeKeyClass">
    <key-property name="fieldTxt1" type="string">
        <column name="fieldTxt1" sql-type="char(5)" unique="false" not-null="false" />
    </key-property>
    <key-property name="fieldTxt2" type="string">
        <column name="fieldTxt3" sql-type="char(1)" unique="false" not-null="false" />
    </key-property>
    <key-property name="fieldInt" type="int">
        <column name="fieldInt" sql-type="integer(9)" unique="false" not-null="false" default="0" />
    </key-property>
    <key-property name="fieldTxt3" type="string">
        <column name="fieldTxt3" sql-type="char(2)" unique="false" not-null="false" />
    </key-property>
</composite-id>


Is it possible (and how) to create a generator class to calculate the value for the integer field?
The <generator> tag is only available in the <id> tag and not in the </composite-id> tag.


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.