-->
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.  [ 5 posts ] 
Author Message
 Post subject: Change Subclass Type?
PostPosted: Wed Dec 03, 2003 7:00 pm 
Beginner
Beginner

Joined: Tue Sep 09, 2003 9:11 pm
Posts: 32
I have a simple hierarchy mapped as <subclass>es:

Parent
- Child 1
-- Sub Child
- Child 2
- Child 3

Is it possible to transform an instance of Child 1 into an instance of Sub Child? Or Child 1 -> Child 3?

We have a product class hierarchy in which a user can switch between an inventory and non-inventory product class. Of course there are some business ramifications we are dealing with, I just am wondering if there is a way to do this with the framework rather than resorting to direct JDBC calls to change the discriminator value?

Chris.....


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 7:44 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
What you want is a way to transform an Apple into a Orange just because they are both fruits.
I strongly suspect you design an incorrect OO hierarchy. The many-to-one tree structure is probably more appropriate in your case

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 7:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is rather more a oo-problem than a hibernate problem. If you can solve the problem of having objects dynamically change types in your class model (which is not quite easy with java), you should have no problems mapping this with hibernate.


Top
 Profile  
 
 Post subject: There are reasons for this....
PostPosted: Wed Dec 03, 2003 10:08 pm 
Regular
Regular

Joined: Sun Sep 21, 2003 11:43 pm
Posts: 85
Location: Massachusetts
I have the same question for my own application. I have various user types: admin (my team/me!), reseller, company, manager and client. I might want to change one from one type to another. I'm using subclass or joined-subclass for each user type.

I don't care of the client has to logout and login again for the change to take effect.

Regards,
David


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 03, 2003 10:17 pm 
Pro
Pro

Joined: Tue Aug 26, 2003 8:07 pm
Posts: 229
Location: Brisbane, Australia
epbernard wrote:
What you want is a way to transform an Apple into a Orange just because they are both fruits.
I strongly suspect you design an incorrect OO hierarchy. The many-to-one tree structure is probably more appropriate in your case


If you decide to listen to Emmanuel, get your hands on copy of the Design Patterns book by the Gang of Four (google it or look an amazon). Read and internalize the first couple of chapters then look up the state and strategy patterns.

_________________
Cheers,
Shorn.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.