-->
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: Can't specify unique index name
PostPosted: Wed Nov 19, 2003 7:26 pm 
Newbie

Joined: Tue Sep 09, 2003 6:19 pm
Posts: 9
I'm using Hibernate 2.0.2.

Here is my mapping file:

<class name="Sample" table="sample">
<id name="id" type="GuidType">
<generator class="GuidGenerator"/>
</id>
<property name="name" type="string">
<column name="name" unique-key="u_idx_sample_name"
not-null="true"/>
</property>
<property name="status" not-null="true" type="StatusType"/>
</class>

Instead of naming the index using the value of unique-key it gives it a name of "SYS_IDX_4".

FYI, I want to name the index so I can inspect the exception for it and throw a custom UniqueViolationException. If I can't name the exception is there a better way to do this?

TIA


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 9:35 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Don't generate the schema through Hibernate?

I craft the database schemas by hand, not only for this reason but many others (i.e., oracle tablespaces, storage options)..


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 19, 2003 9:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hibernate creates the unique constraint in the create table, not an alter table - so the database assigns a name.


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.