-->
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: Reg. Generator in Composite key
PostPosted: Mon Mar 08, 2010 8:44 am 
Newbie

Joined: Mon Mar 08, 2010 8:37 am
Posts: 1
Hi,

I have a composite key in which i need one amongthe key to be set to auto-increment. Could you please guide me how to proceed with this? I have kept my coposite key code below...

Code:
<class name="com.oem.dlms.campaign.dto.CampaignDetails"
      table="CAMPAIGNS">
      <composite-id name="campaignKey"
         class="com.oem.dlms.campaign.dto.CampaignKey">
         <key-property name="campaignId" column="CAMPAIGN_ID"
            type="int" />
         <key-property name="version" column="VERSION_NO" type="int" />
      </composite-id>

      <property name="campaignName" column="NAME" />


I need the campaignId alone to get incremented.

Thanks in advance for your time and valuable guidance.

Regards,
Sakthi.


Top
 Profile  
 
 Post subject: Re: Reg. Generator in Composite key
PostPosted: Mon Mar 08, 2010 9:11 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
I think it is not supported. Read http://docs.jboss.org/hibernate/stable/ ... ompositeid

First paragraph after the note:

Quote:
You cannot use an IdentifierGenerator to generate composite keys. Instead the application must assign its own identifiers.


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.