-
Mar 1st, 2007, 01:59 PM
#1
Composite key using Hibernate Annotations
Hey all,
Can someone give me a proper example for Composite key using Hibernate Annoations.
suppose
Table1 : Product { id(pk), name }
Table2 : Item { id(pk), name }
Table12 :ProductItem{id(pk) , productId(fk) , itemId(fk) }
pk - primary key
fk - foreign key
can anyone implement above define tables using hibernate annotaions
-
Mar 2nd, 2007, 02:47 AM
#2
-
May 8th, 2008, 04:45 AM
#3
CompositeKey Mapping problem in Hibernate
Hi All,
I Am also trying to know , how to do mapping in hbm for a composite key.
I have two tables.From Table A we are using two columns as composite key.And that composite key is the forgen key in Table B.Please tell somebody how to do the mapping in hbm and how to write the enity
Thnx in advance
Regards
Debapriya
-
Jun 1st, 2008, 06:13 PM
#4
Recently I need to define composite unique key in hibernate mapping.
The example lower is illustrating this:
<hibernate-mapping>
<class name="name.platonov.MyType" table="My_TYPE">
<id name="id" column="ID" />
<property name="name" column="NAME" />
<property name="prop1" column="PROP1" unique-key="UK_MY_TYPE" />
<property name="prop2" column="PROP2" unique-key="UK_MY_TYPE" />
</class>
</hibernate-mapping>
In this hibernate mapping prop1 and prop2 are defined as composite unique key.
-
Jan 18th, 2011, 10:23 PM
#5
Composite key using hibernate Annotation
its always better to use Annotation instead of using HBM files to map the tables.. I just went through one site http://j2eereference.com , which explain this with simple example .
http://j2eereference.com/2011/01/imp...and-hibernate/
-
Jan 20th, 2011, 08:14 AM
#6
Thank you !! 
Last edited by berbatov; Jan 24th, 2011 at 04:31 AM.
-
Aug 7th, 2012, 07:30 AM
#7
Last edited by dhanaiahk; Aug 7th, 2012 at 07:36 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules