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