• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

mapping in hibernate

 
simon valter
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im having a bit of problems figuring out how to do the best mapping for my domain.

I have a:

User object that have a Bookshelf

The bookshelf have Booklines that contains a reference to a Book and some other atributes

I have the bookshelf because i thought it would be best to have methods there and not on the user for get/add book and so on.

The bookline contains information about if the book is avalible and so on.

Even if more users have the same book the book is only 1 time in the database.

With my current mapping i get a bookshelf table only containing the id of itself and that id is a foreign key in the bookline.
Does that even make sense?
I would think it would be better to have the userid in the userline
but i still would like to have the booklines added to the bookshelf set when its retrived from the database.

Can someone please point me in the right direction and suggest the mappings used?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic