• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to create a Hibernate mapping to get the use the class this way with the following DB schema?

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an existing DB schema with the following tables,

Items(item_id, item_price, item_description, category, creation_date, last_update_date)
Item_Components(parent_id, component_id, effective_date, creation_date, last_update_date)

I can only figure out a wat to create a mapping and use this Item class:




And the ItemComponent class:



But I would like to end up with a class similar to this one:




Notice that instead of a list of ItemComponents I would like a list of items.

I can't figure out a way to create a mapping where I can use this last class with my current schema.


(Note: The columns component_id and parent_id are foreign key references of the column item_id if the Items table)

Can someone help?

Thanks.



 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can You describe me, what is your problem and what is the goal of this mapping. What finally you want to get from this type of mapping.
 
Amy N. Snow
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

xsunil kumar wrote:Can You describe me, what is your problem and what is the goal of this mapping. What finally you want to get from this type of mapping.



Right now with my current mapping I have no problems. I was just wondering is there was any way to create the class in the second way I mentioned.

Its an Item - Item component parent/child relationship.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic