-->
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: Generate unique values using Hibernate and/or XDoclet
PostPosted: Wed Mar 29, 2006 8:35 am 
Newbie

Joined: Wed Mar 29, 2006 1:43 am
Posts: 1
Location: Brasov
Hello,

I need some help in the following issue:

I have a composite id of three fields, and one of them has to be unique.

I know that the Hibernate specifications says NOT to use composite id, but the database design demands it.

My issue is that I have to generate unique values and I would like that the database to set them - pretty much like autoincrement.
I have searched all over internet, "Hibernate in Action", etc., for setting an autoincrement column inside a composite id, but there seems there is no way using Hibernate and XDoclet (yes, I'm using XDoclet for generating the hbm.xml files).

If anyone knows a way of creating unique values either by adding an autoincrement column inside a composite id using Hibernate and/or XDoclet, either by using some very simple and robust mechanism, please let me know.

Thank you in advance !

PS: I'm using Hibernate 3.1.0 and XDoclet 1.2.3.
The database is MySQL 4.1.5, but in the future I will use Oracle (so please provide a solution compatible with MySQL and Oracle - in fact a more generic solution will be better :) ).


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.