First ,
if you use Eclipse IDE , you can install the Hibernate plugin and do a reverse engineer on the database .This will automatically create the POJOs and the mapping files for you .
http://www.hibernate.org/hib_docs/tools ... ugins.html
if this is not the case , let me see if i get it right :
you have two tables with the same name , so i'm going to try and map only the first and second table , the third should be the same thing :
you have a one to many relationship between tbp_spot_media -> tbl_spot_media_video_format with the foregin key column spot_media_id
Code:
<set name="spotMediaVideoFormats" inverse="true" >
<key>
<column name="spot_media_id" not-null="false"/>
</key>
<one-to-many class="xx.yyy.zzz.SpotMediaVideoFormat" />
</set>
and in the SpotMediaVideoFormat.hbm.xml you should have something like this :
Code:
<many-to-one name="adresa" class="xx.yyy.zzz.SpotMedia">
<column name="spot_id"/>
</many-to-one>
hope it helps .
Victor[/code]