-->
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.  [ 1 post ] 
Author Message
 Post subject: Use <subselect> as join table? (or the burning time ma
PostPosted: Mon May 16, 2005 9:32 am 
Newbie

Joined: Mon Feb 28, 2005 7:57 am
Posts: 7
Location: Toulouse, France
Hello.

Is this possible to use a <subselect> instead of a real table or view to make a many-to-many association ?

I have to map a many-to-many association between two tables, but there is no join table. This association is based on a tricky interval system.

The database schema is actually something like 15 years old and cannot be changed. And the database stores too much data to add views in it now.

Below is a simplified view of the join request.

Is there a way to use it as a real join table in a many-to-many association, or a way to use this subselect directly in the many-to-many declaration itself.

A bidirectionnal association isn't absolutly mandatory if it can helps.

Code:
<class name="JoinAB">
    <subselect>
        select distinct
            a.idA1, a.idA2,
            b.idB1, b.idB2, b.idA1_start, b.idA1_end
        from
            A as a, A as aStart, A as aEnd, B as b
        where
            aStart.idA1 = b.idA1_start
            and aEnd.idA1 = b.idA1_end
            and aStart.idA2 <= a.idA2
            and a.idA2 < aEnd.idA2
    </subselect>
   
    <synchronize table="A"/>
    <synchronize table="B"/>

    <composite-id>
        <key-property name="idA1"/>
        <key-property name="idA2"/>
        <key-property name="idB1"/>
        ...
    </composite-id>
</class>


PS : For the hibernate Team. Resolving this problem can help me to make a worldwide industry leader to look closer at Hibernate. What ?? Look i so desparate !!! ... I am !! ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.