Haha, Others don't want to take this choice just because it is not a easy job if working on a huge database. Luckly I just have the small one.
But I still got the problem to let the JAVA code Hibernate generated to work, so sad~~~ How to insert data and why I got unmapping class error?
Here is two of my mappling files generated by the Middlgen.
User.hbm.xml
-
<hibernate-mapping>
-
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
-
<class name="test.User" table="users">
-
<id name="uno" type="java.lang.Integer" column="Uno">
<generator class="assigned"/>
</id>
<property name="uname" type="java.lang.String" column="UName" not-null="true" length="25"/>
<!-- associations -->
<!-- bi-directional one-to-many association to Model -->
-
<set name="models" lazy="true" inverse="true">
-
<key>
<column name="Uno"/>
</key>
<one-to-many class="test.Model"/>
</set>
</class>
</hibernate-mapping>
_________________________________
Model.hbm.xml
<hibernate-mapping>
-
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
-
<class name="test.Model" table="model">
-
<id name="mid" type="java.lang.Long" column="MID">
<generator class="assigned"/>
</id>
<property name="ctime" type="java.sql.Timestamp" column="CTime" not-null="true" length="19"/>
<!-- associations -->
<!-- bi-directional many-to-one association to User -->
-
<many-to-one name="user" class="test.User" not-null="true">
<column name="Uno"/>
</many-to-one>
-
<!--
bi-directional one-to-many association to Structurelist
-->
-
<set name="structurelists" lazy="true" inverse="true">
-
<key>
<column name="MID"/>
</key>
<one-to-many class="test.Structurelist"/>
</set>
-
<!--
bi-directional one-to-many association to Simulation
-->
-
<set name="simulations" lazy="true" inverse="true">
-
<key>
<column name="MID"/>
</key>
<one-to-many class="test.Simulation"/>
</set>
</class>
</hibernate-mapping>
______________________________
When i try to insert the data to the user table , I got 2 problems, one is cannot insert , the other is unmapping class test.Model.
If anybody can help? Thanks