-->
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.  [ 6 posts ] 
Author Message
 Post subject: How much of hibernate
PostPosted: Fri Mar 19, 2004 5:21 am 
Beginner
Beginner

Joined: Thu Mar 18, 2004 8:11 am
Posts: 38
Location: Italy
Dears,

I submitted a (probably) too articulate question yesterday.

I'm trying to reduce it to the following:

how much of the database structure must be described in the hibernate mappings and how much of it can be left described by my db-creating sql script? Ie: constraints. I have a table which must be unique on a cluster of two columns. I don't see how to describe it in the hibernate mapping, so I'm asking if I can just create the table with this contraint and let the db 'inform' (by a constraint violation error) the hibernate layer when something goes wrong. Also, I have table columns like 'name' whose uniqueness must be case-insensitive. Can I apply the same strategy?

Thank you,

Giampaolo


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 19, 2004 7:16 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
set unique="samename" on your both properties

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 19, 2004 7:35 am 
Beginner
Beginner

Joined: Thu Mar 18, 2004 8:11 am
Posts: 38
Location: Italy
Well, but this way I would encforge uniqueness on both columns. I instead want something like PostgreSQL 'unique(colA, colB)', which means that uniqueness is to be enforced for the clustered columns (ie: colA+colB), not for each one.

Thanks anyway,

Giampaolo

_________________
Giampaolo Tomassoni
Italy


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 19, 2004 11:04 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Quote:
set unique="samename" on your both properties


will give you exactly what you describe.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 19, 2004 10:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually it is unique-key="samename" :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 20, 2004 10:16 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
ah, damnit :)


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