-->
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.  [ 2 posts ] 
Author Message
 Post subject: one to many or parent child relationship
PostPosted: Sun Oct 15, 2006 11:19 pm 
Newbie

Joined: Sun Oct 15, 2006 10:50 pm
Posts: 2
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

HI All,
I have searched the forum but wasn't able to find close to my
requirements. I am a newbie to hibernate would greatly appreciate
if any inputs on how can i go about solving this issue

I have composite key based table to retrieve more like a tree
structure based entries

Code:

--------------------             
|CategoryMaster |
|-------------------                                               
| categoryId(PK)
| catName           
| cateDesc                   
--------------------

--------------------       
| Subcategory    |
--------------------
| subcatId(PK)   
| categoryId(FK) 
| subcatName     
| subcatDesc     
--------------------

--------------------
| CategryDetails |
--------------------
|catdetailId(PK) 
|categoryId(FK)   
|subcatId(FK)   
|catDetailName
|catDetailDesc
-------------------


basically wanted insert values based on foreign key constraints
e.g categoryDetails can contain values only for the available categoryId
and subcatId available on parent tables

Also retrieve details by giving categoryId and subcategoryId

I would greatly appreciate if someone could give me some pointers/examples/tutorials
whether i should use composite key mappings or parent child relations
to achieve the above functionality.

PS:- All PK e.g categoryId, subcatId, catdetailId is generated by sequence
iam using hibernate version 3.1 and MySql 5

Thanks a lot


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 15, 2006 11:45 pm 
Senior
Senior

Joined: Tue Aug 23, 2005 8:52 am
Posts: 181
This forum should have lots of cases like that -- having extra columns on the association table. Just do a search for "extra columns association table".

Here are some pointers
http://www.hibernate.org/118.html#A10
or check out the hibernate doc at
http://www.hibernate.org/hib_docs/v3/re ... ollections


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.