Hi there,
Given the following db table
--------------------------
Column_name Type Length Prec Scale Nulls Default_name Rule_name Identity
-------------- -------- --------- ------- -------- -------- --------------- ------------ -----------
id smallint 2 (null) (null) true (null) (null) false
origin varchar 50 (null) (null) true (null) (null) false
originID varchar 6 (null) (null) true (null) (null) false
destination varchar 50 (null) (null) true (null) (null) false
destinationID varchar 6 (null) (null) true (null) (null) false
I want to generate all "origin" objects with "abbreviation" (originID) and "name" (origin) with their equivelant "destinations" in a *many-to-many* relationship.
Prior to hibernate I used JDBC to do the trick by using the following 2 statements.
select distinct originID from fromto where destinationID != '~~~'
and
select destinationID, destination from fromto where originID = ?
I've tried to create a .hbm file to do the mapping but with no success.
Any help much appreciated :(
TIA
-
Hibernate mapping many-to-many using same class (0 messages)
- Posted by: Markos Charatzas
- Posted on: May 10 2004 08:16 EDT