Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Hibernate XML Mapping many to many join Tabelle mit Fremd S
PostPosted: Wed Jun 06, 2012 8:10 am 
Newbie

Joined: Wed Jun 06, 2012 6:12 am
Posts: 3
Hallo
Ich habe schon lange gesucht aber leider nicht gefunden.Ich habe bereit ein many zu many Beziehung zwischen zwei Tabelle A und B "gemapped" ,die Verbindungstabelle ist auch schon normal erzeugt worden A_B bis dahin ist alles ok,mein Problem ist ich mochte gern ein extra Splate in der Tabelle A_B für ein Fremd Schlüssel ein Tabelle C die mit A_B ein one to many Association bildet .Wie kann mann das in Hibernate umsetzen ?
meine Beide Mapping Datei:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 01.06.2012 13:10:01 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="com.sysberry.sqlportal.dao.Employee" table="EMPLOYEE">
        <id name="Employee_Id" type="long">
            <column name="EMPLOYEE_ID" />
            <generator class="native" />
        </id>
---
<set name="projects" table="PROJECT_EMPLOYEE" cascade="all" inverse="false" lazy="true">
            <key>
                <column name="EMPLOYEE_ID" />
            </key>
            <many-to-many class="com.sysberry.sqlportal.dao.Projects" >
             <column name="PROJECTS_ID"/>
            </many-to-many>
        </set>
    </class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 01.06.2012 13:10:01 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="com.sysberry.sqlportal.dao.Projects" table="PROJECTS">
        <id name="Projects_Id" type="long">
            <column name="PROJECTS_ID" />
            <generator class="native" />
        </id>
<set name="employee" table="PROJECT_EMPLOYEE" inverse="false" lazy="true">
            <key>
                <column name="PROJECTS_ID" />
            </key>
            <many-to-many class="com.sysberry.sqlportal.dao.Employee">
             <column name="EMPLOYEE_ID" /   >
            </many-to-many>
        </set>
    </class>
</hibernate-mapping>


Danke


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

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.