-->
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: Example does not use Identifier when available!
PostPosted: Thu Sep 22, 2005 5:55 am 
Newbie

Joined: Sun Feb 13, 2005 6:39 am
Posts: 11
Location: Belgium
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

I'm trying to create a general search facility via the Criteria and Example API, and when trying to create an sub Example that contains only a PK, it is not used when quering.

I have a business object BO1 which has a association with a BO2.
I start creating a Criteria object by adding an exampleof BO1, and linking a SubCriteria where I add the Example of BO1.getBO2().

Here is the code
Code:
DetachedCriteria detachedCriteria =  DetachedCriteria.forClass(BO1.class);
            detachedCriteria.add(Example.create(bo1Filter));
           
            // add the criteria for the related objects.
            if(bo1Filter.getBO2() != null) {                               
                detachedCriteria.createCriteria("bo2").add(Example.create(bo1Filter.getBO2()));
            }


What am I doing wrong?

It seems that only the properties are used as part of the where clause and not the Identifier when available.

Any help is welcome.
Kind regards,
Nico


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.