ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

How do you map Java Objects with Database tables?


First we need to write Java domain objects (beans with setter and getter).
Write hbm.xml, where we map java class to table and database columns to Java class variables.
Example :
<hibernate-mapping>
  <class name="com.test.User"  table="user">
   <property  column="USER_NAME" length="255"
      name="userName" not-null="true"  type="java.lang.String"/>
   <property  column="USER_PASSWORD" length="255"
     name="userPassword" not-null="true"  type="java.lang.String"/>
 </class>
</hibernate-mapping>
Related Posts Plugin for WordPress, Blogger...
Flag Counter