Sorry,the next is my Messages.hbm.xml,the class is "Messages",not what i wanted "Message",my database is MySQL. <?xml version="1.0" ?> <!DOCTYPE hibernate-mapping (View Source for full doctype...)> - <!-- Generated 2009-6-4 8:36:28 by Hibernate Tools 3.2.0.beta8 --> - <hibernate-mapping default-cascade="none" default-access="property" default-lazy="true" auto-import="true"> - <class name="Messages" table="messages" catalog="hibernatestudy" mutable="true" polymorphism="implicit" dynamic-update="false" dynamic-insert="false" select-before-update="false" optimistic-lock="version"> <comment /> - <id name="messageId" type="long"> <column name="MESSAGE_ID" /> <generator class="assigned" /> </id> - <many-to-one name="messages" class="Messages" fetch="select" unique="false" update="true" insert="true" optimistic-lock="true" not-found="exception" embed-xml="true"> - <column name="NEXT_MESSAGE_ID"> <comment /> </column> </many-to-one> - <property name="messageText" type="string" unique="false" optimistic-lock="true" lazy="false" generated="never"> - <column name="MESSAGE_TEXT"> <comment /> </column> </property> - <set name="messageses" inverse="true" sort="unsorted" mutable="true" optimistic-lock="true" embed-xml="true"> - <key on-delete="noaction"> - <column name="NEXT_MESSAGE_ID"> <comment /> </column> </key> <one-to-many class="Messages" not-found="exception" embed-xml="true" /> </set> </class> </hibernate-mapping>
|