-->
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.  [ 8 posts ] 
Author Message
 Post subject: Conceptional question about mixed mapping
PostPosted: Thu Dec 15, 2005 11:27 pm 
Newbie

Joined: Thu Dec 15, 2005 10:59 pm
Posts: 8
Location: Trier
Hi,

I'm currently migrating our framework from Castor to Hibernate, and therefore revisited every part of it again. So did I for the SQL mapping part.
I had a (maybe somewhat crazy) idea of mixing mappings and at a first glance at the docs it looked like hibernate would support that (it even *was* the docs which inspired me, even...).

First, some words about mappings: I didn't think about table per class hierarchy before, I thought that's just too crazy in a production environment to even think about. At least with our framework. But, if you think further about it, it has its advantages in some areas, as it avoids having too much left outer joins in the polymorphic queries.

I might remark that we have a common superclass structure.

So, having a huge amount of data in a single entity (we are talking of millions of rows compared to a few hundrets in others), the other entities disturb this entity, as they enrich its table by adding a huge amount of columns which are simply not needed for it.

The idea I had is somewhat simple: There's a space consumption for attributes in an own table (joined subclass) and in another, which is "migrated" (subclass). The decision wether to migrate or not can be accomplished by counting the entity members and calculating the wasted amount of space when migrating against the space consumption when creating tables (with a factor regarding the fact that it introduces another left outer join, index lookup and such).

I thought it's a good idea. Until I tried to get hibernate working with that...

At the moment it seems not possible to *really* mix subclass and joined-subclass mapping, at least the dtd does not let me do this. There's an example which suggests using join for that, which isn't usable for me as it's not possible to map any many relation inside the join anymore (It's really thought for something else I guess).

My question is (yes, I get to the final point now...): Is the idea all that dump, or am I'm overlooking something, or is this just plain impossible with hibernate yet?

Thanks in advance for your time,

Patric


Top
 Profile  
 
 Post subject: Too hard, or completely mad?
PostPosted: Mon Dec 19, 2005 3:55 am 
Newbie

Joined: Thu Dec 15, 2005 10:59 pm
Posts: 8
Location: Trier
Seems that nobody is interested in that one... ?


Top
 Profile  
 
 Post subject: Anyone?
PostPosted: Sun Dec 25, 2005 9:57 am 
Newbie

Joined: Thu Dec 15, 2005 10:59 pm
Posts: 8
Location: Trier
I'm stunned... I still think it's a good idea; while testing I can see that at least for postgres the "table per inheritance tree" is somewhat faster... although it starts getting slower the more there are huge quantities of another entity in the table; despite the fact that there's a limit in the number of columns (Don't know exactly, but I think pagesize 8kb per row or something); although it seems to get somewhat ineffective quite before that limit already.
But working with table per concrete class is also somewhat inefficient, as it results in quite a lot of outer joins; which results in a separate index lookup for each join - in inheritence hierarchies of 200 entities, this is not very performant.
Am I the only one doing the "common superclass" mapping and using hibernate?

Patric


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 25, 2005 10:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
If your posting (or a question you are referring to) was not answered by anybody, the possible reasons are:

- http://www.hibernate.org/ForumMailingli ... AskForHelp
- You did not submit enough information
- Nobody knows the answer or has the free time to answer

What you can do now:

- Do the things listed in After Posting
- Add missing and/or more information
- Consider commercial support for guaranteed expert response times

This is a high-traffic forum run by volunteers with hundreds of postings made every day. The community works because people try to help others in their free time. Nobody is paid for this service or has to pay.

You should not expect a timely response and you should not rely on a public community forum for critical cases.

All community members should respect the rules of this forum and treat others like they would prefer to be treated.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: nobody answered...
PostPosted: Tue Dec 27, 2005 3:48 pm 
Newbie

Joined: Thu Dec 15, 2005 10:59 pm
Posts: 8
Location: Trier
Hi max,

I can't say I'm very happy with your posting to my topic. I think I'm a sensitive user of the forum (as I am in any forum or mailinglist I use), so there's no need for this instructive tone...

- it's a conceptional question, and it's verbosely explained.
- I provided additional information after investigating the topic further
- I wasn't impatient to "push" it after roughly a week or so.

So I'm not abusing this forum, I just had the feeling nobody was interested or didn't even know what to answer. Additionally, it's christman, after all, so I thought there might be people on vacation this time, so I intended to provide even more information about my idea beginning january; so I might be lucky and one of the gurus takes a look at it.
Normally, I tend to solve my problems by myself, and providing help to others; but this topic seemed to be completely untouched so far. The docs tell something about mixing the mapping schemes, but this special case, a very interesting IMHO, does not seem to work. I will test and analyze this further, but I was not expecting some answer like this.

I might be overly sensitive, but I didn't disturb or hurt someone with my rather patient way of not relying on timely answers or blaming anyone on anything. It's a conceptional question, after all.

Anyway, I'm still hoping on some answer... if noone is interested or nobody even knows, it's ok. I'm used to the fact that some of my questions never been answered at all - for the one or the other reason... I always find an answer, sooner or later. It's more like sharing the idea might inspire some other people to think about it, too.

So far,

Patric


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 27, 2005 3:57 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
I answered to this one "Seems that nobody is interested in that one... ?"
- we don't have time to answer all questions and it is xmas.

_________________
Max
Don't forget to rate


Last edited by max on Tue Dec 27, 2005 6:02 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Sorry
PostPosted: Tue Dec 27, 2005 4:21 pm 
Newbie

Joined: Thu Dec 15, 2005 10:59 pm
Posts: 8
Location: Trier
Hi max,

sorry. Didn't see the 15mins lag between my attempt to provide additional information and your answer. So far, it looked like I just wanted to push, which wasn't the case, as you see.

It's christman, I know... I mentioned it. I didn't expect a "timely" answer, whatever that means. As I said, it's no normal support request, just a "share the idea" and discussion with some more experienced hibernate users respective developers.

:-)

Patric


Top
 Profile  
 
 Post subject: Re: Sorry
PostPosted: Mon Jan 16, 2006 3:38 pm 
Beginner
Beginner

Joined: Thu Mar 18, 2004 8:11 am
Posts: 38
Location: Italy
I'm facing the very same problem.

I would like to have the following hierarchy:


Code:
    <class name="Name" schema="prod" table="names">
        <id name="id"><generator class="native"/></id>

      ... some properties spec ...
        </class>

        ... some other <joined-subclass> of Name ...

        <joined-subclass name="CategoryAttribute"
         extends="Name"
===>     abstract="true"
        >
                <key column="idName"/>

===>            <discriminator column="type"
                 type="String"
                 length="1"
                 not-null="true"
                />

                ... some shared properties ...
        </joined-subclass>

        <subclass name="StringCategoryAttribute"
         extends="CategoryAttribute"
         discriminator-value="S"
         schema="prod" tab="stringCatAttributes"
        >
                ... properties unique to this class ...
        </subclass>

        <subclass name="NumericCategoryAttribute"
         extends="CategoryAttribute"
         discriminator-value="N"
         schema="prod" tab="numericCatAttributes"
        >
                ... properties unique to this class ...
        </subclass>


but the elements and attributes marked with a '===>' are not supported by the Hibernate DTD. Not even to mention that, probably, an abstract <joined-subclass> means that the Hibernate code has to "migrate" the semantic of the <key> element to the implementing <subclass>es...

I'm trying to evinct an alternative way of specifying this, but I'm not shure if it exists and pretty shure it is less strightforward...

Please also note that a question like this is also expressed in http://forum.hibernate.org/viewtopic.php?t=944767&highlight=mixing+hierarchy, so at least we don't feel alone in the darkness. :)

Regards

_________________
Giampaolo Tomassoni
Italy


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