-->
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.  [ 3 posts ] 
Author Message
 Post subject: how to define the id index name
PostPosted: Thu Jun 29, 2006 11:58 am 
Newbie

Joined: Tue Jun 21, 2005 5:23 am
Posts: 8
Hibernate version: 3.1.3

Given:
Code:
  <id name="id">
   <generator class="seqhilo">
    <param name="sequence">MY_ID</param>
    <param name="max_lo">100</param>
   </generator>
  </id>


leads to cryptic index names in Oracle like SYS_C006147
Is it possible to manually define the index name?

Also i dont know how to define the index name of multi-column unique key constraints. Its easy to define the index name of a single column unique key constraint, but i totaly fail to define it for the id column and multi column keys.

thx for your feedback
Bernhard


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 29, 2006 1:05 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
create an sequence for your table in oracle

and use this for id

Code:
<generator class="sequence">
                <param name="sequence">YOUR_SEQ</param>
            </generator>


also here is how you map a composite key

http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#mapping-declaration-compositeid

I suggest you read HIA book and other tutorial floating around

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 29, 2006 3:09 pm 
Newbie

Joined: Tue Jun 21, 2005 5:23 am
Posts: 8
I chosen seqhilo for compatibility reasons (works also in postgresql), but yes currently it makes sense to switch to a pure sequence aproach in my case.

And im using artificial ids because i wanted to use them instead of compositeid. But when i use an artificial key the natural multi-column unique constraint will be still there => i know how to define it, but im unable to give it a meaningful name. Hibs DDL generator does not define any name and as such ora will autoname it to SYS0000x.

So it is still the same question: How to define the keyname. There are some jira bugreports dealing with this issue. Graven posted that hibernate is lacking on the capability to set the index name - but his post is from 2003 (hib 2.1.x) and as such i hoped that the current 3.1.x hib is able to handle it.

Bernhard


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.