-->
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: Unique key constraint generation
PostPosted: Wed Apr 25, 2007 11:47 pm 
Newbie

Joined: Wed Nov 08, 2006 9:42 am
Posts: 5
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Problems with Session and transaction handling?

Read this: http://hibernate.org/42.html


I want help for generating the Unique key constraint using .hbm.xml

<property name="name" type="java.lang.String" >
<column name="name" sql-type="mediumtext"
not-null="true" index="products_name_idx" />
</property>

<many-to-one name="products"
class="dao.entity.Products"
cascade="none" not-null="true" column="product_id"
unique-key="products_name_idx" />

Actually combinations name and product_id is unique.How to generate this using .hbm.xml, so that it will geneate corresponding index name in the mysql data base.

Next,
I used the index attribute in the property tag. but it is not generating the index corresponding index name in the data base. Is there any solution for this.
If any one know about this pls, reply.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 26, 2007 12:13 am 
Senior
Senior

Joined: Sat Aug 19, 2006 6:31 pm
Posts: 139
Hi,

Look at the following. I think it might help you.

http://www.hibernate.org/hib_docs/v3/re ... -naturalid

http://www.hibernate.org/hib_docs/v3/re ... properties

_________________
Don't forget to rate the reply if it helps..:)

Budyanto


Top
 Profile  
 
 Post subject: Unique key constraint generation -issues
PostPosted: Thu Apr 26, 2007 1:10 am 
Newbie

Joined: Wed Nov 08, 2006 9:42 am
Posts: 5
himawan wrote:


Thanks a lot,
I solved that problem using natural-id.

Is there any way to change the index name in the mysql data base using index attribute in the property in .hbm.xml


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.