-->
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.  [ 3 posts ] 
Author Message
 Post subject: why find by example returns me not exact records
PostPosted: Fri Jun 08, 2007 9:26 am 
Beginner
Beginner

Joined: Thu Jan 20, 2005 1:45 pm
Posts: 49
Hi all
I have a function that uses Example API with MacthMode.EXACT.
The problem is that when i passed it an object with just its id specified, the functions return me all records starting with that id.
I need an EXACT search matchmode.I already specified it in MatchMode.EXACT but the problem is not solved.
My function :
public Collection findByExample(Object example) throws PersistenceException {
log.info("findByExample...");
Collection collection;
try {

Criteria crit = HibernateSessionFactory.getSession()
.createCriteria(mappedClass);
collection = crit.add(Example.create(example).enableLike(MatchMode.EXACT)).list();

} catch (HibernateException ex) {
throw new PersistenceException(ex);
}
return collection;
}


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 10:08 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
as described in the doc, id and version are ignored

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 08, 2007 12:10 pm 
Beginner
Beginner

Joined: Thu Jan 20, 2005 1:45 pm
Posts: 49
and what should I use similarly?
I'd like query using example bcs is easy for me.
Regards


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