-->
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.  [ 5 posts ] 
Author Message
 Post subject: two attributes composing a key
PostPosted: Fri Dec 26, 2003 3:33 pm 
Regular
Regular

Joined: Thu Dec 25, 2003 12:33 am
Posts: 58
Location: Campina Grande, Brasil
how to write a mapping so i can have a table where a pair of attributes can't be repeated? for instance, the 2-upla (name, parent) can't be repeated, even if "name" can be repeated, and "parent" can be repeated, but the groupt of two can't.
Thanks

Ot


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 26, 2003 8:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Check out the manual. Your question is answered in the section on composite keys http://www.hibernate.org/hib_docs/reference/html/or-mapping.html#or-mapping-s1-4b

eg,
Code:
<composite-id>
        <key-property name="name"/>
        <key-property name="parent"/>
</composite-id>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 27, 2003 1:20 pm 
Regular
Regular

Joined: Thu Dec 25, 2003 12:33 am
Posts: 58
Location: Campina Grande, Brasil
In fact, i have to say i did not undestand a thing about this mapping technique. The docs seem to resumed to me.
If someone has a good example on that approach, please show me.

Thanks a lot.

_________________
Ot


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 27, 2003 10:42 pm 
Beginner
Beginner

Joined: Sun Dec 21, 2003 11:19 pm
Posts: 22
Location: Kentucky, USA
Ot


Top
 Profile  
 
 Post subject:
PostPosted: Sat Dec 27, 2003 10:47 pm 
Regular
Regular

Joined: Thu Dec 25, 2003 12:33 am
Posts: 58
Location: Campina Grande, Brasil
I've heard some about this tool, but never used it. I'm gonna take some time and study it. thanks a lot. if that worked for you, that means it can be a nice way.

Thanks

_________________
Ot


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