-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: About creation of a hbm.xml file with the following scenario
PostPosted: Fri Sep 07, 2007 4:51 am 
Newbie

Joined: Fri Sep 07, 2007 3:42 am
Posts: 2
Hi Everybody

I am new to this forum, and I am learning the hibernate I have a question in the hbm file creation -----
The scenario is I have an Employee table with empId as Primary key and I have a Department table with DepartmentId as the primary key. In the same database I have one more table which is EmployeeDepartment where one employee can have multiple departments,,, In this table I have only two fields EmpId and DepartmentId, now I want to create a hbm for EmployeeDepartment so what will be the structure and how will be the mapping............
Please, give me a feed back with an example so that I am able to use that hbm and able to insert the data into that table by using a front-end.

Regards,
Sarikaa


Top
 Profile  
 
 Post subject: example of hbm
PostPosted: Fri Sep 07, 2007 6:03 am 
Newbie

Joined: Fri Sep 07, 2007 4:16 am
Posts: 16
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.dsdatafashion.domain.persistence.hibernate.GrpAmmNeg" table="GRP_AMM_NEG" >
<composite-id name="id" class="com.dsdatafashion.domain.persistence.hibernate.GrpAmmNegId">
<key-many-to-one name="amsCpzTip" class="com.dsdatafashion.domain.persistence.hibernate.AmsCpzTip">
<column name="COD_TIP_GRP_NEGZ" length="6" />
<column name="COD_GRP" length="6" />
</key-many-to-one>
<key-many-to-one name="negz" class="com.dsdatafashion.domain.persistence.hibernate.Negz">
<column name="COD_NEGZ" precision="4" scale="0" />
</key-many-to-one>
</composite-id>
<property name="dataIsr" type="java.util.Date">
<column name="DATA_ISR" length="7" />
</property>
<property name="dataUpd" type="java.util.Date">
<column name="DATA_UPD" length="7" />
</property>
<property name="whoIsr" type="java.lang.String">
<column name="WHO_ISR" length="17" />
</property>
<property name="whoUpd" type="java.lang.String">
<column name="WHO_UPD" length="17" />
</property>
<property name="flgOdt" type="java.lang.Long">
<column name="FLG_ODT" precision="1" scale="0" />
</property>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 07, 2007 6:27 am 
Newbie

Joined: Fri Sep 07, 2007 3:42 am
Posts: 2
I don't want to use any composite id, because I am working with Hibernate in GWT where my class won't accept the java.io.Serializable manner, with out using composite id how can i resolve this problem


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.