facebook

Hibernate reverse engineering:how to map list

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #273351 Reply

    d17may
    Member

    i have 2 tables .table1 column id which is foreign key to table2 which has column parent_id to
    hold table1 id value ,column idx to hold index value.My mapping file looks like this

    
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping 
        PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" 
        "hibernate-mapping-2.0.dtd">
    <hibernate-mapping>
    <class name="List_1" 
         table="List_1">
         <id name="id" unsaved-value="0">
            <generator class="increment"/>
        </id>
        
        <list name="stories" cascade="all">
            <key column="parent_id"/>
            <index column="idx"/>
            <one-to-many class="List_2"/>
        </list>
        <property name="name" type="java.lang.String" column="description"/>
    </class>
    <class name="List_2" 
         table="List_2">
         <id name="id" unsaved-value="0">
            <generator class="increment"/>
        </id>
          <property name="info" column="track"/>
    </class>
    </hibernate-mapping>
    

    I don’t know how to generate one mapping file for 2 tables which are connected.
    Thanks

    #273385 Reply

    d17may
    Member

    is this is possible in myeclipse or not

    #273403 Reply

    Loyal Water
    Member

    MyEclipse will generate 1 POJO and 1 mapping file per table when doing the reverse engineering, so the answer is no, MyEclipse won’t generate a single mapping file for 2 or more tables.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Hibernate reverse engineering:how to map list

You must be logged in to post in the forum log in