-->
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: Using Hibernate Tools 3.1.5 does not creat unique constraint
PostPosted: Thu Nov 10, 2005 3:46 pm 
Beginner
Beginner

Joined: Thu Oct 13, 2005 3:40 pm
Posts: 29
I am using Hibernate Tools 3.1.5 and most of my tables have multi-column unique constraints. If the Hibernate Artifact Generation plug-in does not create the unique constrainst despite checking "Generate basic typed composite ids".

How do I include unique constraints in the *.hbm.xml file so that the generated SELECTs include both the columns in the where clause?

Thanks in advance!

Atul

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:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 10, 2005 4:07 pm 
Beginner
Beginner

Joined: Thu Oct 13, 2005 3:40 pm
Posts: 29
The scenario is:

I have 3 tables STORE, FISCAL_PERIOD, and STORE_DETAIL. The STORE_DETAIL has two columns store_id (pk for STORE table) and fiscal_period_id (pk for FISCAL_PERIOD table). These two columns form a unique constraint in STORE_DETAIL table

I have a class Store that has getStoreDetails() that returns a set. However, I'd like to get storeDeatils for a specific fiscal_period_id. I was hoping that using Artifact Generation, the unique constraint would automatically be created providing me a method to getStoreDetailsByFiscalPeriod(FiscalPeriod fp).

Is that true, if not, am I missing something, do I have to write custom code in the generated POJOs to provide this?

Thanks!

Atul


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.