-->
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: QBE on many to one relation
PostPosted: Thu Oct 01, 2009 11:01 am 
Newbie

Joined: Thu Oct 01, 2009 10:52 am
Posts: 1
Hi,

I have a problem when I do a query by example on a field that had a many to one relation.

Code:
user = new UserDO();
user.setName("Jean");
users = userDAO.getUsers(user);


This works fine, and will create a query like "... where (this_.NAME=?)" and will hence return a list of users with name "Jean".

However, when I do this:

Code:
AddressDO address = new AddressDO();
address.setStreet("some street");
user = new UserDO();
user.setAddress(address);
users = userDAO.getUsers(user);


This will not work and create a query like "... where (1=1)"

There is a many to one relation between address and user:

Code:
        <many-to-one name="address" class="package.AddressDO" fetch="select">
            <column name="ADDRESS_ID"/>
        </many-to-one>


Is there any way to get this to work?

TIA


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.