-->
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: inheritance and hibernate
PostPosted: Sat Sep 25, 2004 12:31 pm 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
I am trying to make sure I understand how hibernate handles inheritance. If I create a mapping file with various subclasses.
For example,
Class B is a parent of class A, so I made A a subclass of B.

I want to create an object A and type cast it to a B object [(B)A]. If I then pass this B object to the hibernate session to save it to the database will all the fields that object A has, that B does not, be saved to the database?

example:
B is the parent class
B contains the following instance variables and getter/setter methods for each.

firstName
lastName

A is the child class (subclass in hibernate mapping file)
A contains the following instance variables and getter/setter methods for each.

firstName - inherited from B
lastName - inherited from B
middleInitial

Will middleInitial be stored in the database if object A is typecast to object B and passed to a hibernate session?

Thanks!!! :)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 25, 2004 4:09 pm 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
I was able to answer this one myself. Thanks.


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.