-->
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.  [ 11 posts ] 
Author Message
 Post subject: subclass inside joined-class element
PostPosted: Fri Oct 03, 2003 4:45 pm 
Newbie

Joined: Wed Sep 10, 2003 3:21 pm
Posts: 18
Location: USA
Hi Gavin,


Are you planing to support subclass element inside joined-subclass ?.
From DTD I can see that it's not supported.
Thanks.

Giedrius


Top
 Profile  
 
 Post subject: Also interest here
PostPosted: Wed Oct 15, 2003 7:11 pm 
Newbie

Joined: Wed Oct 15, 2003 1:52 am
Posts: 7
Hi,

This is a feature that I'm also interested in; specifically, putting "subclass" inside "joined-subclass". It seems that if you put the "discriminator" tag in a joined-subclass, and then put subclasses in, it seems to read fine -- but the whole thing dies at runtime (database constraint).

It would seem logical to me that you should be able to put discriminators in joined-subclasses (without the need for a special "join" tag; seen in another thread) -- especially if you don't want to mix the two beyond that, e.g.:

Code:
<joined-subclass ...>
  <joined-subclass ...>
    <discriminator />
    <subclass ... />
    <subclass ... />
  </joined-subclass>
</joined-subclass>


This is pretty much exactly what I need to do for the application I'm building. Obviously this is open source, so I guess I should get in there and add it. However, if there's some alternative on the roadmap, I'd be interested to know. It's really just a performance/storage optimization, more than anything else -- not a priority at this stage.

Simon.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 7:30 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
The roadmap includes the <join> element, which could be used to do this.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 7:31 pm 
Newbie

Joined: Wed Oct 15, 2003 1:52 am
Posts: 7
Would you be able to think up a quick example of how this would work?

Thanks

Simon.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 7:31 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
there is an exampe ON the roadmap!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 7:45 pm 
Newbie

Joined: Wed Oct 15, 2003 1:52 am
Posts: 7
Thanks for the pointer... That does look like it would be a useful tag.

It seems to be able to introduce extra tables -- however, I'm trying to reduce the number of tables/updates. For example, parent classes with all the attributes, and child classes introducing nothing new other than logic -- these don't really need their own tables, since they contain nothing other than IDs. So the best thing is to put a discriminator type thing in the parent class definition. Which works, as long as the parent classes isn't a joined-class inside another class (or another joined-class).

Is there a way to refactor the example I gave above to use the <join> tag?

Thanks

Simon.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 7:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
AH, ok, if thats what you want then no, there is nothing planned. The <join> feature would only help if you had a discriminator on the top-level table.

You would need a new persister for this kind of thing.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 7:58 pm 
Newbie

Joined: Wed Oct 15, 2003 1:52 am
Posts: 7
I'd be interested in contributing this, but would need a place to start. Would it be easy to combine the discriminator logic for the <class> and <joined-subclass> tags?

Simon.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 7:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
No it would certainly not be easy. Try something smaller to start off with.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 8:00 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
PS. The relevant code is EntityPersister/NormalizedEntityPersister


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 15, 2003 8:18 pm 
Newbie

Joined: Wed Oct 15, 2003 1:52 am
Posts: 7
Thanks, I'll at least have a look at it. I'm sure it's a feature that at least a few people would appreciate, so it's probably worth investigating.

Regards

Simon.


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