facebook

Some question about Develope Hibernate3 in Myeclipse4.1.1?

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #247964 Reply

    Tringle
    Member

    Dear all:
    These days I tried to develope struts and hibernate3 application in Myeclipse4.1.1.I used the wizard to add the hibernate capabilities to the JavaProject and used the Create Hibernate Mapping Item of the DB Brower’s PopupMenu.But I found something special.It generated three java file and one hbm.xml file.The three java file name are: AbstractAssessGrade.java, AssessGrade.java and AssessGradeId.java.The hbm.xml file generated like the following:

    <hibernate-mapping>
    <class name=”com.test.grade.AssessGrade” table=”AssessGrade” schema=”dbo” catalog=”kpi_tg”>
    <composite-id name=”id” class=”com.test.grade.AssessGradeId”>
    <key-property name=”gradeId” type=”string”>
    <column name=”gradeId” length=”32″ />
    </key-property>
    <key-property name=”gradeName” type=”string”>
    <column name=”gradeName” length=”50″ />
    </key-property>
    <key-property name=”maxGrade” type=”double”>
    <column name=”maxGrade” precision=”18″ scale=”3″ />
    </key-property>
    <key-property name=”minGrade” type=”double”>
    <column name=”minGrade” precision=”18″ scale=”3″ />
    </key-property>
    <key-property name=”limitCount” type=”integer”>
    <column name=”limitCount” />
    </key-property>
    <key-property name=”createTime” type=”timestamp”>
    <column name=”createTime” length=”23″ />
    </key-property>
    </composite-id>
    </class>
    </hibernate-mapping>

    ❓ What’s the “composite-id” element and the AssessGradeId.java?
    This hbm.xml file’s structure is not like those examples in the Hibernate3.1.2.zip.
    ❓ Can anyone tell me how the three java file work?
    In the Hibernate3.1.2.zip’s examples there are onle one POJO and hbm.xml file .

    #247975 Reply

    Haris Peco
    Member

    Tringle,

    MyEclipse use hibernate 3.0.5 version, but it isn’t important for your problem

    You can suppress generate Abstract class in Page 1 wizard (un-check ‘Create Abstract class’).Intention for abstract class is change and regenerate mappings (regenerate doesn’t touch class,only abstract class), but you can suppress this.
    Composite Id class is generated when your table have composite PK (primary key with > 1 columns).It is pattern from hibernate (see chapter 8.4 in hibernate documentation).If you have table with simple PK (one column PK) and unchecked ‘Create Abstract class’ you will got one POJO and one hbm.xml.
    However, you can work with composite ID (with/without Abstract class) – it;s same like your one POJO/One hbm.xml examples

    If you have problem still, then send us mappings and your usage snippet (test case or what ever)

    Best

    #247985 Reply

    Tringle
    Member

    Oh,I see. Thanks

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Some question about Develope Hibernate3 in Myeclipse4.1.1?

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