-->
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.  [ 4 posts ] 
Author Message
 Post subject: Help with Bind Queries
PostPosted: Wed Apr 04, 2007 6:02 pm 
Newbie

Joined: Wed Apr 04, 2007 5:56 pm
Posts: 2
If I have the following hibernate config:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="com.Event" table="EVENT">
<id name="quuid" column="quuid">
<generator class="assigned" />
</id>
<component name="message" class="com.Message">
<property name="id" column="MESSAGE_ID" />
</component>
</class>
</hibernate-mapping>

How can I access the nested object with a query?

I have this:
Query query = getSession().createQuery(
"from Event e, ?message m? where e.quuid = vendorQuuid and m.id = seqNo");

The hibernate guide doesn't deomstrate this from what I could tell.

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 3:27 pm 
Newbie

Joined: Thu Mar 15, 2007 10:11 am
Posts: 19
Location: Dallas
I have this:
Query query = getSession().createQuery(
"from Event e, ?message m? where e.quuid = vendorQuuid and m.id = seqNo");

You need to use something like

Query query = getSession().createQuery(
"from Event e where e.quuid =:vendorQuuid and e.message.id =:seqNo");

and bind those two variables. query.setString(....

Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 4:56 pm 
Newbie

Joined: Wed Apr 04, 2007 5:56 pm
Posts: 2
I actually came up with this before your post but thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 05, 2007 5:10 pm 
Newbie

Joined: Thu Mar 15, 2007 10:11 am
Posts: 19
Location: Dallas
Oh. then, i should not have replied (wasted time on reading the issue), if you did not rate this issue.


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