-->
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.  [ 2 posts ] 
Author Message
 Post subject: joined-subclass confusion
PostPosted: Tue Feb 01, 2005 3:40 am 
Newbie

Joined: Tue Feb 01, 2005 3:21 am
Posts: 1
Hello,

Can somebody please help me resolve this issue:

Hibernate version:

2.1.5

Mapping documents:

<class name="MainMessage" table="ParentMsg">
<id name="id" type="int" column="ID">
<generator class="native" />
</id>
<property name="version" type="int" column="VERSION" length="10" />
<property name="state" type="java.lang.String" column="STATE" not-null="true" length="1" />

<joined-subclass name="ChildMessage" table="ChildMsg" lazy="true">
<key column="VALUE_ID"/>
<property name=".......etc.. />

<set name="MessagesSet" sort="natural" order-by="MSG_ID">
<key column="MSG_ID" foreign-key="ID"/>
<one-to-many class="messages" />
</set>

</joined-subclass>

<query name="AllMessages">
<![CDATA[from MainMessage main
-------------------TO BE FILLED IN
where MessagesSet.someOtherId=?

]]>
</query>

</class>

I am looking for a query which can get me some data items from the MainMessage, some from ChildMessage and others from MessagesSet.

I am not sure how to set up the joins here. Or in other words how do I access the columns(properties) from the MessagesSet in the query above using MaintMessage, ChildMessage and MessagesSet all in the same query. The where clause actually contains columns belonging to the MessagesSet.

I keep getting some cglib errors or classcastexceptions, or "cannot resolve property" errors.

Name and version of the database you are using:

Oracle 9i

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 01, 2005 7:55 am 
Contributor
Contributor

Joined: Thu Nov 06, 2003 9:49 pm
Posts: 104
Location: New York, NY
Let Hibernate do the joins for you. http://www.hibernate.org/hib_docs/refer ... ryhql.html


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