-->
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: Down casting (ie turning an object into a joined-subclass)
PostPosted: Thu May 17, 2007 3:42 am 
Newbie

Joined: Wed Apr 11, 2007 12:24 am
Posts: 3
Location: Melbourne
Hi all,

Hopefull an obvious one but have wraked my brain and come up with nothing.

Imagine I have 2 persistent classes.

Code:
Class Person
{

}

class Employee : Person
{

}


<Employee> is a joined-subclass of a person.

I was thinking I might be able to do the following....

Code:
Get(typeof(Person),1)
Employee emp = Person as Employee;
Save(emp);


Am I able to turn a person into an employee....Yes this is a downcast, but I could easily do it in database speak by adding a row to the employee table...??

If I just construct a new Employee and copy the fields over and save I'll get an error...

I think maybe I am missing something obvious here. Any thoughts much appreciated.

Anthony


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 17, 2007 8:26 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
If you have a proxy it sounds like the same problem discussed in this post:

http://forum.hibernate.org/viewtopic.ph ... 4c0330724d

Symon.


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.