-->
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: Hibernate Many-to-Many
PostPosted: Mon Mar 13, 2006 9:24 am 
Newbie

Joined: Tue Mar 07, 2006 8:31 am
Posts: 7
Hibernate Tools 3.1 beta 4
Eclipse SDK 3.1.2
PostgreSQL 8.1

Hi all again!

I am very new in hibernate and java, and i would appreciate some help or example that someone have.

I have a simple many-to-many association! Like Person and Equipment and we create a Person_Equipment table with two PKs like PersonID and EquipmentID.

Code:
CREATE TABLE person (
id int8 CONSTRAINT PK_person_id PRIMARY KEY,
firstname varchar(50),
surname varchar(50)
)
WITHOUT OIDS

CREATE TABLE equipment (
id int8 CONSTRAINT PK_equipment_id PRIMARY KEY,
title varchar(50),
description varchar(500)
)
WITHOUT OIDS

CREATE TABLE person_equipment (
person_id int8,
equipment_id int8,
CONSTRAINT FK_person_id FOREIGN KEY (person_id) REFERENCES person (id),
CONSTRAINT FK_equipment_id FOREIGN KEY (equipment_id) REFERENCES equipment (id)
)
WITHOUT OIDS


The Hibernate tool creates 3 mapping files for person, equipment and person_equipment and 3 POJO-Classes. I need only two POJO classes with association HashSets between person and equipment.

How can i create the mapping file and POJO for this situation?

Thanks,
Eugene Lechner


Last edited by Eugen on Mon Mar 13, 2006 9:27 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 9:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
not supported/doable in the tools at the moment.

if you want to know how to do it via the mapping files go read about many-to-many in the docs (there is examples)

_________________
Max
Don't forget to rate


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.