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: Dont fully understand the mapping syntax for a 2 column uniq
PostPosted: Thu Apr 05, 2007 4:23 am 
Newbie

Joined: Thu Mar 15, 2007 1:22 am
Posts: 11
Hibernate version:
Hibernate3
Mapping documents:
None
Code between sessionFactory.openSession() and session.close():
None
Name and version of the database you are using:
Postgres 8.2

create table reference.hose (
id SERIAL PRIMARY KEY,
name varchar(255) NOT NULL,
man varchar(255) NOT NULL,
unique(name,man)
);

Given the fictious table above, I have tried <composite-elements> <composite-id>
and a few others :). What would the mapping look like for something like this. I have been trying to use hbm.xml first and then generating the schema and pojo's from that. The issue was that when I couldn't figure it out, I tried middle gen. Middlegen 2.1 currently only supports hibernate 2.X mappings, so it could be an issue with middlegen.

Any ideas, would be appreciated

Thomas


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 6:57 am 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
Don't know if this work with nhibernate but with hibernate you can use unique-key to create a multi column unique constraint. Something like :
Code:
<property name="name" unique-key="nameman"/>
<property name="man" unique-key="nameman"/>

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


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.