Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate mapping

 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

Here i have attached my two table(xml)..tell me how to map this two table..i want to fetch value from two table..i tried but i could not..i visited hibernate.org website also..still i failed



this is my Employeeclass


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file generated by seetharaman //precision="22" scale="0"
-->
<hibernate-mapping>
<class name="com.genuitec.hibernate.Employees" table="EMPLOYEES">
<id name="username" type="java.lang.String">
<column name="username" />
<generator class="increment" />
</id>
<property name="password" type="java.lang.String">
<column name="password" />
</property>
<property name="roleid" type="java.lang.String">
<column name="roleid" />
</property>
<property name="name" type="java.lang.String">
<column name="name" />
</property>
<property name="phone" type="java.lang.String">
<column name="phone" />
</property>
<property name="email" type="java.lang.String">
<column name="email" />
</property>
<property name="depid" type="java.lang.String">
<column name="depid" />
</property>

</class>
</hibernate-mapping>


this is my department class

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file generated by seetharaman //precision="22" scale="0"
-->
<hibernate-mapping>
<class name="com.genuitec.hibernate.Departments" table="departments">
<id name="depid" type="java.lang.String">
<column name="DEPID" />
<generator class="assigned" />
</id>
<property name="depname" type="java.lang.String">
<column name="DEPNAME" />
</property>


</class>


----> please any one help me



thanks & regards,

seetharaman
 
Amit Y Desai
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a good option is to download hibernate synchronizer from net..Its a plugin for eclipse..it connects with database and asks you which tables you want to map to...and next next next..you are done..all java files + hbm files + mapping in hibernate.cfg.xml...all done
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic