-->
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: Theta joins with composite-element
PostPosted: Mon Feb 13, 2006 8:09 am 
Senior
Senior

Joined: Fri Jun 18, 2004 10:17 am
Posts: 140
Hi,

I've run into a wall with an issue that I hope you can help with. I have a parent object Page with a set association assets. In order to achieve a binding of Page to Assets in different "zones" I had to create a composite-element in the assets set association.

I now need to query for 2 lists. List 1 is all assets that have a binding in PageAsset. List 2 is all assets that do not have a binding in PageAsset.

In SQL this is a straightforward inner join between asset.id and pageasset.asset_id to get List 1. Below is what I have tried but I am told that PageAsset is not mapped, presumably because it's a composite-element.

List 2 I have not tried a query for yet.


Hibernate version: 3.0

Mapping documents:

Code:
        <set name="assets" table="tblPageAssets" lazy="false" cascade="none">
            <key column="page_id" not-null="true" />
           
            <composite-element class="PageAsset">
            <many-to-one name="asset" class="Asset" column="asset_id" cascade="all" />
            <property name="peerPosition" column="peer_position" type="int" not-null="true" />
            <property name="zone" column="zone" type="string" not-null="true" />
         </composite-element>
        </set>


Code between sessionFactory.openSession() and session.close():

Code:
    public List<Asset> getAssets() {
       return (List<Asset>) getHibernateTemplate().find(
         "from Asset asset, PageAsset pa " +
         "where asset.id = pa.asset.id"
      );
    }


Debug level Hibernate log excerpt:

PageAsset is not mapped


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.