-->
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: Find by Example and associated classes
PostPosted: Sun Feb 12, 2006 8:58 am 
Newbie

Joined: Tue Nov 15, 2005 2:14 am
Posts: 7
I have a problem for Find By Example queries. I have a class A with a reference to a class B. when I set a property of the B class the Find By Example mechanism does not use the B property to generate the sql query (according to the documentation it is normal).

Code:
Session current = sessionFactory.getCurrentSession();
Criteria criteria = current.createCriteria(instance.getClass()).add(Example.create(instance));


But I my case I have only one method to search my object by example taking a java.lang.Object as argument. So I can not do the following code

Code:
List results = session.createCriteria(Cat.class)
.add( Example.create(cat) )
.createCriteria("mate")
.add( Example.create( cat.getMate() ) )
.list();


Because the class name is never the same. How can I determine when I receive a class that has associated classes?[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 15, 2006 2:30 pm 
Newbie

Joined: Tue Nov 15, 2005 2:14 am
Posts: 7
Any idea?


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.