facebook

[Closed] Hibernate/Spring mapping problem

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

    I have a MyEclipse web project that has Hibernate, Spring and Struts capabilities. I ran the Generate Hibernate Mapping function from the DB explorer. The files seemed to be generated and the project compiles without error. When I start Tomcat I get the following error:

    Could not find a getter for statusNo in class net.icenhower.dao.Answer

    Here’s the Answer.hbm.cml file:

    <!-- 
        Mapping file autogenerated by MyEclipse - Hibernate Tools
    -->
    <hibernate-mapping>
        <class name="net.icenhower.dao.Answer" table="answer" catalog="datapool">
            <id name="answerNo" type="integer">
                <column name="AnswerNo" />
                <generator class="assigned" />
            </id>
            <property name="questionNo" type="integer">
                <column name="QuestionNo" not-null="true" />
            </property>
            <property name="dispOrder" type="integer">
                <column name="DispOrder" not-null="true" />
            </property>
            <property name="otherRsp" type="string">
                <column name="OtherRsp" length="1" not-null="true" />
            </property>
            <property name="statusNo" type="integer">
                <column name="StatusNo" not-null="true" />
            </property>
            <property name="ansLen" type="integer">
                <column name="AnsLen" not-null="true" />
            </property>
            <property name="lastUser" type="integer">
                <column name="LastUser" not-null="true" />
            </property>
            <property name="lastUpdate" type="timestamp">
                <column name="LastUpdate" length="19" />
            </property>
            <set name="responses" inverse="true">
                <key>
                    <column name="AnswerNo" not-null="true" />
                </key>
                <one-to-many class="net.icenhower.dao.Response" />
            </set>
        </class>
    </hibernate-mapping>
    

    I do have a Status table in the database but the Answer table does not have a foreign key to it. What do I need to change?
    Thanks!
    Jim

    #254292 Reply

    Haris Peco
    Member

    Jim,

    This error

    Could not find a getter for statusNo in class net.icenhower.dao.Answer

    mean that you haven’t getStatusNo method in POJO Answer.java

    If you want that MyEclipse generate collection you have to add foreig keys for table or you can change mapping after generating.

    Best regards

    #254298 Reply

    Thanks for the prompt and precise answer! Still loving MyEclipse!
    Jim

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: [Closed] Hibernate/Spring mapping problem

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