Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

How do you map Java Objects with Database tables?
First we need to write Java domain objects (beans with setter and getter). The variables should be same as database columns. Write hbm.xml, where we map java class to table and database columns to Java class variables. 
Example :
<hibernate-mapping>
  <class name="com.User"  table="user">
   <property  column="username" length="255" 
      name="userName" not-null="true"  type="java.lang.String"/>
   <property  column="userpassword" length="255"
     name="userPassword" not-null="true"  type="java.lang.String"/>
 </class>
</hibernate-mapping>