This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
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

Hibernate 2.1 mapping

 
annie ja
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i am new to hibernate. i have a query.

i have the following class heirarchy

Interface A
Class B implements A (class B is an abstract class)

Class C extends B
Class D extends B
Class E extends B

Class F extends C

What will be the mapping for this if i were to use table per class hierarchy

what i wanted to know was that we do not store the state of C in the data store. so should my mapping be

<hibernate-mapping>
<class name="B" ..... >
<discriminator column = ......>

<subclass name ="C" discriminator-value="C" >
<subclass name = "F" discriminator-value="F" >
....
</subclass>
<subclass>
</class>
</hibernate-mapping>

OR

<hibernate-mapping>
<class name="B" ..... >
<discriminator column = ......>

<subclass name = "F" discriminator-value="F" >
....
</subclass>
</class>
</hibernate-mapping>

can i directly say omitting the subclass C as its state is not being saved. Class C only has some behavior and no state. do i have to maintain exact hiearchy in my mapping. will hibernate work properly in the second case.
How does hibernate work internally. can anyone point me to some document which mentions internal functioning of hibernate.


Thanks in advance
 
Mohd. Yakub
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi annie,
A nice article on this..see the link
http://www-128.ibm.com/developerworks/java/library/j-hibernate/

regards,
yakub
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic