Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Amy N. Snow
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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.



 
xsunil kumar
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic